fetch: make --no-history and --no-hooks switches consistent

Before this commit, the following switches exist:

- --nohooks
- --no-history

They are not consistent. This commit makes the following switches
available:

- --nohooks, --no-hooks
- --nohistory, --no-history

Bug: None
Change-Id: Iaea2357c05e3dc69e3fac0fb9d823db903d811bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3904446
Auto-Submit: Thiago Perrotta <tperrotta@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
This commit is contained in:
Thiago Perrotta
2022-09-20 16:50:02 +00:00
committed by LUCI CQ
parent 18bdadc98a
commit 512dfd676b
2 changed files with 39 additions and 33 deletions

View File

@@ -140,7 +140,7 @@ class GclientGitCheckout(GclientCheckout, GitCheckout):
sync_cmd = ['sync']
if self.options.nohooks:
sync_cmd.append('--nohooks')
if self.options.no_history:
if self.options.nohistory:
sync_cmd.append('--no-history')
if self.spec.get('with_branch_heads', False):
sync_cmd.append('--with_branch_heads')
@@ -154,7 +154,7 @@ class GclientGitCheckout(GclientCheckout, GitCheckout):
'submodule', 'foreach',
'git config -f $toplevel/.git/config submodule.$name.ignore all',
cwd=wd)
if not self.options.no_history:
if not self.options.nohistory:
self.run_git(
'config', '--add', 'remote.origin.fetch',
'+refs/tags/*:refs/tags/*', cwd=wd)
@@ -194,10 +194,17 @@ def handle_args(argv):
parser.add_argument('-n', '--dry-run', action='store_true', default=False,
help='Don\'t run commands, only print them.')
parser.add_argument('--nohooks', action='store_true', default=False,
help='Don\'t run hooks after checkout.')
parser.add_argument('--no-history', action='store_true', default=False,
help='Perform shallow clones, don\'t fetch the full git history.')
parser.add_argument('--nohooks',
'--no-hooks',
action='store_true',
default=False,
help='Don\'t run hooks after checkout.')
parser.add_argument(
'--nohistory',
'--no-history',
action='store_true',
default=False,
help='Perform shallow clones, don\'t fetch the full git history.')
parser.add_argument('--force', action='store_true', default=False,
help='(dangerous) Don\'t look for existing .gclient file.')
parser.add_argument(