diff options
author | Gavin Mak <gavinmak@google.com> | 2023-03-11 06:46:20 +0000 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-22 17:46:28 +0000 |
commit | ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1 (patch) | |
tree | dc33ba0e56825b3e007d0589891756724725a465 /subcmds/selfupdate.py | |
parent | 1604cf255f8c1786a23388db6d5277ac7949a24a (diff) | |
download | git-repo-ea2e330e43c182dc16b0111ebc69ee5a71ee4ce1.tar.gz |
Format codebase with black and check formatting in CQ
Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught
by flake8. Also check black formatting in run_tests (and CQ).
Bug: b/267675342
Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'subcmds/selfupdate.py')
-rw-r--r-- | subcmds/selfupdate.py | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py index 898bc3f2..d5d0a838 100644 --- a/subcmds/selfupdate.py +++ b/subcmds/selfupdate.py | |||
@@ -21,12 +21,12 @@ from subcmds.sync import _PostRepoFetch | |||
21 | 21 | ||
22 | 22 | ||
23 | class Selfupdate(Command, MirrorSafeCommand): | 23 | class Selfupdate(Command, MirrorSafeCommand): |
24 | COMMON = False | 24 | COMMON = False |
25 | helpSummary = "Update repo to the latest version" | 25 | helpSummary = "Update repo to the latest version" |
26 | helpUsage = """ | 26 | helpUsage = """ |
27 | %prog | 27 | %prog |
28 | """ | 28 | """ |
29 | helpDescription = """ | 29 | helpDescription = """ |
30 | The '%prog' command upgrades repo to the latest version, if a | 30 | The '%prog' command upgrades repo to the latest version, if a |
31 | newer version is available. | 31 | newer version is available. |
32 | 32 | ||
@@ -34,28 +34,33 @@ Normally this is done automatically by 'repo sync' and does not | |||
34 | need to be performed by an end-user. | 34 | need to be performed by an end-user. |
35 | """ | 35 | """ |
36 | 36 | ||
37 | def _Options(self, p): | 37 | def _Options(self, p): |
38 | g = p.add_option_group('repo Version options') | 38 | g = p.add_option_group("repo Version options") |
39 | g.add_option('--no-repo-verify', | 39 | g.add_option( |
40 | dest='repo_verify', default=True, action='store_false', | 40 | "--no-repo-verify", |
41 | help='do not verify repo source code') | 41 | dest="repo_verify", |
42 | g.add_option('--repo-upgraded', | 42 | default=True, |
43 | dest='repo_upgraded', action='store_true', | 43 | action="store_false", |
44 | help=SUPPRESS_HELP) | 44 | help="do not verify repo source code", |
45 | 45 | ) | |
46 | def Execute(self, opt, args): | 46 | g.add_option( |
47 | rp = self.manifest.repoProject | 47 | "--repo-upgraded", |
48 | rp.PreSync() | 48 | dest="repo_upgraded", |
49 | 49 | action="store_true", | |
50 | if opt.repo_upgraded: | 50 | help=SUPPRESS_HELP, |
51 | _PostRepoUpgrade(self.manifest) | 51 | ) |
52 | 52 | ||
53 | else: | 53 | def Execute(self, opt, args): |
54 | if not rp.Sync_NetworkHalf().success: | 54 | rp = self.manifest.repoProject |
55 | print("error: can't update repo", file=sys.stderr) | 55 | rp.PreSync() |
56 | sys.exit(1) | 56 | |
57 | 57 | if opt.repo_upgraded: | |
58 | rp.bare_git.gc('--auto') | 58 | _PostRepoUpgrade(self.manifest) |
59 | _PostRepoFetch(rp, | 59 | |
60 | repo_verify=opt.repo_verify, | 60 | else: |
61 | verbose=True) | 61 | if not rp.Sync_NetworkHalf().success: |
62 | print("error: can't update repo", file=sys.stderr) | ||
63 | sys.exit(1) | ||
64 | |||
65 | rp.bare_git.gc("--auto") | ||
66 | _PostRepoFetch(rp, repo_verify=opt.repo_verify, verbose=True) | ||