diff options
| author | Mike Frysinger <vapier@google.com> | 2020-02-17 14:36:08 -0500 |
|---|---|---|
| committer | David Pursehouse <dpursehouse@collab.net> | 2020-02-19 00:24:43 +0000 |
| commit | c58ec4dba102d88fec67e833eb8421202eb4c1ea (patch) | |
| tree | c8c84e03f9359ae9dd126854069d34207c298831 /subcmds | |
| parent | e1191b3adb22e0b406db87691b13ddab2c236267 (diff) | |
| download | git-repo-c58ec4dba102d88fec67e833eb8421202eb4c1ea.tar.gz | |
avoid negative variables
Trying to use booleans with names like "no_xxx" are hard to follow due
to the double negatives. Invert all of them so we only have positive
meanings to follow.
Change-Id: Ifd37d0368f97034d94aa2cf38db52c723ac0c6ed
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255493
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/init.py | 10 | ||||
| -rw-r--r-- | subcmds/rebase.py | 4 | ||||
| -rw-r--r-- | subcmds/selfupdate.py | 4 | ||||
| -rw-r--r-- | subcmds/sync.py | 18 |
4 files changed, 18 insertions, 18 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index dde97286..3c68c2c3 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -146,10 +146,10 @@ to update the working directory files. | |||
| 146 | 'platform group [auto|all|none|linux|darwin|...]', | 146 | 'platform group [auto|all|none|linux|darwin|...]', |
| 147 | metavar='PLATFORM') | 147 | metavar='PLATFORM') |
| 148 | g.add_option('--no-clone-bundle', | 148 | g.add_option('--no-clone-bundle', |
| 149 | dest='no_clone_bundle', action='store_true', | 149 | dest='clone_bundle', default=True, action='store_false', |
| 150 | help='disable use of /clone.bundle on HTTP/HTTPS') | 150 | help='disable use of /clone.bundle on HTTP/HTTPS') |
| 151 | g.add_option('--no-tags', | 151 | g.add_option('--no-tags', |
| 152 | dest='no_tags', action='store_true', | 152 | dest='tags', default=True, action='store_false', |
| 153 | help="don't fetch tags in the manifest") | 153 | help="don't fetch tags in the manifest") |
| 154 | 154 | ||
| 155 | # Tool | 155 | # Tool |
| @@ -161,7 +161,7 @@ to update the working directory files. | |||
| 161 | dest='repo_branch', | 161 | dest='repo_branch', |
| 162 | help='repo branch or revision', metavar='REVISION') | 162 | help='repo branch or revision', metavar='REVISION') |
| 163 | g.add_option('--no-repo-verify', | 163 | g.add_option('--no-repo-verify', |
| 164 | dest='no_repo_verify', action='store_true', | 164 | dest='repo_verify', default=True, action='store_false', |
| 165 | help='do not verify repo source code') | 165 | help='do not verify repo source code') |
| 166 | 166 | ||
| 167 | # Other | 167 | # Other |
| @@ -281,9 +281,9 @@ to update the working directory files. | |||
| 281 | m.config.SetString('repo.submodules', 'true') | 281 | m.config.SetString('repo.submodules', 'true') |
| 282 | 282 | ||
| 283 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, | 283 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, |
| 284 | clone_bundle=not opt.no_clone_bundle, | 284 | clone_bundle=opt.clone_bundle, |
| 285 | current_branch_only=opt.current_branch_only, | 285 | current_branch_only=opt.current_branch_only, |
| 286 | no_tags=opt.no_tags, submodules=opt.submodules, | 286 | tags=opt.tags, submodules=opt.submodules, |
| 287 | clone_filter=opt.clone_filter): | 287 | clone_filter=opt.clone_filter): |
| 288 | r = m.GetRemote(m.remote.name) | 288 | r = m.GetRemote(m.remote.name) |
| 289 | print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) | 289 | print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) |
diff --git a/subcmds/rebase.py b/subcmds/rebase.py index eb92a3c7..24d80bfd 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py | |||
| @@ -53,7 +53,7 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 53 | dest='force_rebase', action='store_true', | 53 | dest='force_rebase', action='store_true', |
| 54 | help='Pass --force-rebase to git rebase') | 54 | help='Pass --force-rebase to git rebase') |
| 55 | p.add_option('--no-ff', | 55 | p.add_option('--no-ff', |
| 56 | dest='no_ff', action='store_true', | 56 | dest='ff', default=True, action='store_false', |
| 57 | help='Pass --no-ff to git rebase') | 57 | help='Pass --no-ff to git rebase') |
| 58 | p.add_option('-q', '--quiet', | 58 | p.add_option('-q', '--quiet', |
| 59 | dest='quiet', action='store_true', | 59 | dest='quiet', action='store_true', |
| @@ -93,7 +93,7 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 93 | common_args.append('--quiet') | 93 | common_args.append('--quiet') |
| 94 | if opt.force_rebase: | 94 | if opt.force_rebase: |
| 95 | common_args.append('--force-rebase') | 95 | common_args.append('--force-rebase') |
| 96 | if opt.no_ff: | 96 | if not opt.ff: |
| 97 | common_args.append('--no-ff') | 97 | common_args.append('--no-ff') |
| 98 | if opt.autosquash: | 98 | if opt.autosquash: |
| 99 | common_args.append('--autosquash') | 99 | common_args.append('--autosquash') |
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py index 4817a862..bf6256ab 100644 --- a/subcmds/selfupdate.py +++ b/subcmds/selfupdate.py | |||
| @@ -40,7 +40,7 @@ need to be performed by an end-user. | |||
| 40 | def _Options(self, p): | 40 | def _Options(self, p): |
| 41 | g = p.add_option_group('repo Version options') | 41 | g = p.add_option_group('repo Version options') |
| 42 | g.add_option('--no-repo-verify', | 42 | g.add_option('--no-repo-verify', |
| 43 | dest='no_repo_verify', action='store_true', | 43 | dest='repo_verify', default=True, action='store_false', |
| 44 | help='do not verify repo source code') | 44 | help='do not verify repo source code') |
| 45 | g.add_option('--repo-upgraded', | 45 | g.add_option('--repo-upgraded', |
| 46 | dest='repo_upgraded', action='store_true', | 46 | dest='repo_upgraded', action='store_true', |
| @@ -60,5 +60,5 @@ need to be performed by an end-user. | |||
| 60 | 60 | ||
| 61 | rp.bare_git.gc('--auto') | 61 | rp.bare_git.gc('--auto') |
| 62 | _PostRepoFetch(rp, | 62 | _PostRepoFetch(rp, |
| 63 | no_repo_verify=opt.no_repo_verify, | 63 | repo_verify=opt.repo_verify, |
| 64 | verbose=True) | 64 | verbose=True) |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 849e878c..1988cc72 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -247,7 +247,7 @@ later is required to fix a server side protocol bug. | |||
| 247 | dest='manifest_name', | 247 | dest='manifest_name', |
| 248 | help='temporary manifest to use for this sync', metavar='NAME.xml') | 248 | help='temporary manifest to use for this sync', metavar='NAME.xml') |
| 249 | p.add_option('--no-clone-bundle', | 249 | p.add_option('--no-clone-bundle', |
| 250 | dest='no_clone_bundle', action='store_true', | 250 | dest='clone_bundle', default=True, action='store_false', |
| 251 | help='disable use of /clone.bundle on HTTP/HTTPS') | 251 | help='disable use of /clone.bundle on HTTP/HTTPS') |
| 252 | p.add_option('-u', '--manifest-server-username', action='store', | 252 | p.add_option('-u', '--manifest-server-username', action='store', |
| 253 | dest='manifest_server_username', | 253 | dest='manifest_server_username', |
| @@ -259,7 +259,7 @@ later is required to fix a server side protocol bug. | |||
| 259 | dest='fetch_submodules', action='store_true', | 259 | dest='fetch_submodules', action='store_true', |
| 260 | help='fetch submodules from server') | 260 | help='fetch submodules from server') |
| 261 | p.add_option('--no-tags', | 261 | p.add_option('--no-tags', |
| 262 | dest='no_tags', action='store_true', | 262 | dest='tags', default=True, action='store_false', |
| 263 | help="don't fetch tags") | 263 | help="don't fetch tags") |
| 264 | p.add_option('--optimized-fetch', | 264 | p.add_option('--optimized-fetch', |
| 265 | dest='optimized_fetch', action='store_true', | 265 | dest='optimized_fetch', action='store_true', |
| @@ -276,7 +276,7 @@ later is required to fix a server side protocol bug. | |||
| 276 | 276 | ||
| 277 | g = p.add_option_group('repo Version options') | 277 | g = p.add_option_group('repo Version options') |
| 278 | g.add_option('--no-repo-verify', | 278 | g.add_option('--no-repo-verify', |
| 279 | dest='no_repo_verify', action='store_true', | 279 | dest='repo_verify', default=True, action='store_false', |
| 280 | help='do not verify repo source code') | 280 | help='do not verify repo source code') |
| 281 | g.add_option('--repo-upgraded', | 281 | g.add_option('--repo-upgraded', |
| 282 | dest='repo_upgraded', action='store_true', | 282 | dest='repo_upgraded', action='store_true', |
| @@ -338,8 +338,8 @@ later is required to fix a server side protocol bug. | |||
| 338 | verbose=opt.verbose, | 338 | verbose=opt.verbose, |
| 339 | current_branch_only=opt.current_branch_only, | 339 | current_branch_only=opt.current_branch_only, |
| 340 | force_sync=opt.force_sync, | 340 | force_sync=opt.force_sync, |
| 341 | clone_bundle=not opt.no_clone_bundle, | 341 | clone_bundle=opt.clone_bundle, |
| 342 | no_tags=opt.no_tags, archive=self.manifest.IsArchive, | 342 | tags=opt.tags, archive=self.manifest.IsArchive, |
| 343 | optimized_fetch=opt.optimized_fetch, | 343 | optimized_fetch=opt.optimized_fetch, |
| 344 | prune=opt.prune, | 344 | prune=opt.prune, |
| 345 | clone_filter=clone_filter) | 345 | clone_filter=clone_filter) |
| @@ -841,7 +841,7 @@ later is required to fix a server side protocol bug. | |||
| 841 | start = time.time() | 841 | start = time.time() |
| 842 | success = mp.Sync_NetworkHalf(quiet=opt.quiet, verbose=opt.verbose, | 842 | success = mp.Sync_NetworkHalf(quiet=opt.quiet, verbose=opt.verbose, |
| 843 | current_branch_only=opt.current_branch_only, | 843 | current_branch_only=opt.current_branch_only, |
| 844 | no_tags=opt.no_tags, | 844 | tags=opt.tags, |
| 845 | optimized_fetch=opt.optimized_fetch, | 845 | optimized_fetch=opt.optimized_fetch, |
| 846 | submodules=self.manifest.HasSubmodules, | 846 | submodules=self.manifest.HasSubmodules, |
| 847 | clone_filter=self.manifest.CloneFilter) | 847 | clone_filter=self.manifest.CloneFilter) |
| @@ -977,7 +977,7 @@ later is required to fix a server side protocol bug. | |||
| 977 | 977 | ||
| 978 | fetched = self._Fetch(to_fetch, opt, err_event) | 978 | fetched = self._Fetch(to_fetch, opt, err_event) |
| 979 | 979 | ||
| 980 | _PostRepoFetch(rp, opt.no_repo_verify) | 980 | _PostRepoFetch(rp, opt.repo_verify) |
| 981 | if opt.network_only: | 981 | if opt.network_only: |
| 982 | # bail out now; the rest touches the working tree | 982 | # bail out now; the rest touches the working tree |
| 983 | if err_event.isSet(): | 983 | if err_event.isSet(): |
| @@ -1067,11 +1067,11 @@ def _PostRepoUpgrade(manifest, quiet=False): | |||
| 1067 | project.PostRepoUpgrade() | 1067 | project.PostRepoUpgrade() |
| 1068 | 1068 | ||
| 1069 | 1069 | ||
| 1070 | def _PostRepoFetch(rp, no_repo_verify=False, verbose=False): | 1070 | def _PostRepoFetch(rp, repo_verify=True, verbose=False): |
| 1071 | if rp.HasChanges: | 1071 | if rp.HasChanges: |
| 1072 | print('info: A new version of repo is available', file=sys.stderr) | 1072 | print('info: A new version of repo is available', file=sys.stderr) |
| 1073 | print(file=sys.stderr) | 1073 | print(file=sys.stderr) |
| 1074 | if no_repo_verify or _VerifyTag(rp): | 1074 | if not repo_verify or _VerifyTag(rp): |
| 1075 | syncbuf = SyncBuffer(rp.config) | 1075 | syncbuf = SyncBuffer(rp.config) |
| 1076 | rp.Sync_LocalHalf(syncbuf) | 1076 | rp.Sync_LocalHalf(syncbuf) |
| 1077 | if not syncbuf.Finish(): | 1077 | if not syncbuf.Finish(): |
