summaryrefslogtreecommitdiffstats
path: root/subcmds/selfupdate.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-04-13 11:51:15 -0700
committerShawn O. Pearce <sop@google.com>2009-04-13 11:53:53 -0700
commite756c412e35b9ac1a126985d4d047dbd52f29277 (patch)
treee5ed4a87a8b078e44c5369fbdf08b8e1c05d1ef6 /subcmds/selfupdate.py
parentb812a3623646adf38f30dd5cf7e92f1e704669a2 (diff)
downloadgit-repo-e756c412e35b9ac1a126985d4d047dbd52f29277.tar.gz
Add 'repo selfupdate' to upgrade only repo
Users may want to upgrade only repo to the latest release, but leave their working tree state alone and avoid 'repo sync'. Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'subcmds/selfupdate.py')
-rw-r--r--subcmds/selfupdate.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py
new file mode 100644
index 00000000..de6904c4
--- /dev/null
+++ b/subcmds/selfupdate.py
@@ -0,0 +1,59 @@
1#
2# Copyright (C) 2009 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16from optparse import SUPPRESS_HELP
17import sys
18
19from command import Command, MirrorSafeCommand
20from subcmds.sync import _PostRepoUpgrade
21from subcmds.sync import _PostRepoFetch
22
23class Selfupdate(Command, MirrorSafeCommand):
24 common = False
25 helpSummary = "Update repo to the latest version"
26 helpUsage = """
27%prog
28"""
29 helpDescription = """
30The '%prog' command upgrades repo to the latest version, if a
31newer version is available.
32
33Normally this is done automatically by 'repo sync' and does not
34need to be performed by an end-user.
35"""
36
37 def _Options(self, p):
38 p.add_option('--no-repo-verify',
39 dest='no_repo_verify', action='store_true',
40 help='do not verify repo source code')
41 p.add_option('--repo-upgraded',
42 dest='repo_upgraded', action='store_true',
43 help=SUPPRESS_HELP)
44
45 def Execute(self, opt, args):
46 rp = self.manifest.repoProject
47 rp.PreSync()
48
49 if opt.repo_upgraded:
50 _PostRepoUpgrade(self.manifest)
51
52 else:
53 if not rp.Sync_NetworkHalf():
54 print >>sys.stderr, "error: can't update repo"
55 sys.exit(1)
56
57 _PostRepoFetch(rp,
58 no_repo_verify = opt.no_repo_verify,
59 verbose = True)