Add --extra_patchlevel flag to apply_issue.py

This will make it possible to cut away additional
levels of directories when applying patches from repos
that have a different directory hierarchy than Chromium.

BUG=438952
TESTED=Executed successfully in a local checkout using
(cwd was the dir above src/):
~/depot_tools/apply_issue.py --root_dir src/third_party/webrtc --issue 1978193002 --server https://codereview.webrtc.org --force --ignore_deps -v -v --no-auth --patchset 20001 --extra_patchlevel=1

Review-Url: https://codereview.chromium.org/1988583002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300615 0039d316-1c4b-4281-b951-d872f2087c98
parent 3f39df00
......@@ -92,6 +92,10 @@ def _get_arg_parser():
help='Don\'t patch specified file(s).')
parser.add_option('-d', '--ignore_deps', action='store_true',
help='Don\'t run gclient sync on DEPS changes.')
parser.add_option('--extra_patchlevel', type='int',
help='Number of directories the patch level number should '
'be incremented (useful for patches from repos with '
'different directory hierarchies).')
auth.add_auth_options(parser)
return parser
......@@ -255,6 +259,8 @@ def main():
if patch.filename not in options.blacklist]
for patch in patchset.patches:
print(patch)
if options.extra_patchlevel:
patch.patchlevel += options.extra_patchlevel
full_dir = os.path.abspath(options.root_dir)
scm_type = scm.determine_scm(full_dir)
if scm_type == 'svn':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment