From d461faae730fdfbfda13c316b038da1f63ce7df5 Mon Sep 17 00:00:00 2001 From: "kjellander@chromium.org" Date: Tue, 17 May 2016 07:15:41 +0000 Subject: [PATCH] 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 --- apply_issue.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apply_issue.py b/apply_issue.py index b0d917631..5e6088735 100755 --- a/apply_issue.py +++ b/apply_issue.py @@ -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':