diff options
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) | ||