summaryrefslogtreecommitdiffstats
path: root/subcmds
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds')
-rw-r--r--subcmds/abandon.py2
-rw-r--r--subcmds/branches.py2
-rw-r--r--subcmds/checkout.py1
-rw-r--r--subcmds/cherry_pick.py1
-rw-r--r--subcmds/diff.py1
-rw-r--r--subcmds/diffmanifests.py2
-rw-r--r--subcmds/download.py1
-rw-r--r--subcmds/forall.py3
-rw-r--r--subcmds/gitc_delete.py1
-rw-r--r--subcmds/grep.py3
-rw-r--r--subcmds/help.py1
-rw-r--r--subcmds/info.py3
-rw-r--r--subcmds/init.py1
-rw-r--r--subcmds/list.py1
-rw-r--r--subcmds/manifest.py1
-rw-r--r--subcmds/prune.py1
-rw-r--r--subcmds/selfupdate.py1
-rw-r--r--subcmds/smartsync.py1
-rw-r--r--subcmds/stage.py3
-rw-r--r--subcmds/start.py1
-rw-r--r--subcmds/status.py1
-rw-r--r--subcmds/sync.py9
-rw-r--r--subcmds/upload.py4
-rw-r--r--subcmds/version.py1
24 files changed, 44 insertions, 2 deletions
diff --git a/subcmds/abandon.py b/subcmds/abandon.py
index 9a645c0a..f3478129 100644
--- a/subcmds/abandon.py
+++ b/subcmds/abandon.py
@@ -21,6 +21,7 @@ from collections import defaultdict
21from git_command import git 21from git_command import git
22from progress import Progress 22from progress import Progress
23 23
24
24class Abandon(Command): 25class Abandon(Command):
25 common = True 26 common = True
26 helpSummary = "Permanently abandon a development branch" 27 helpSummary = "Permanently abandon a development branch"
@@ -32,6 +33,7 @@ deleting it (and all its history) from your local repository.
32 33
33It is equivalent to "git branch -D <branchname>". 34It is equivalent to "git branch -D <branchname>".
34""" 35"""
36
35 def _Options(self, p): 37 def _Options(self, p):
36 p.add_option('--all', 38 p.add_option('--all',
37 dest='all', action='store_true', 39 dest='all', action='store_true',
diff --git a/subcmds/branches.py b/subcmds/branches.py
index b4894ec8..9709f7f0 100644
--- a/subcmds/branches.py
+++ b/subcmds/branches.py
@@ -19,6 +19,7 @@ import sys
19from color import Coloring 19from color import Coloring
20from command import Command 20from command import Command
21 21
22
22class BranchColoring(Coloring): 23class BranchColoring(Coloring):
23 def __init__(self, config): 24 def __init__(self, config):
24 Coloring.__init__(self, config, 'branch') 25 Coloring.__init__(self, config, 'branch')
@@ -26,6 +27,7 @@ class BranchColoring(Coloring):
26 self.local = self.printer('local') 27 self.local = self.printer('local')
27 self.notinproject = self.printer('notinproject', fg='red') 28 self.notinproject = self.printer('notinproject', fg='red')
28 29
30
29class BranchInfo(object): 31class BranchInfo(object):
30 def __init__(self, name): 32 def __init__(self, name):
31 self.name = name 33 self.name = name
diff --git a/subcmds/checkout.py b/subcmds/checkout.py
index c8a09a8e..efa31d26 100644
--- a/subcmds/checkout.py
+++ b/subcmds/checkout.py
@@ -19,6 +19,7 @@ import sys
19from command import Command 19from command import Command
20from progress import Progress 20from progress import Progress
21 21
22
22class Checkout(Command): 23class Checkout(Command):
23 common = True 24 common = True
24 helpSummary = "Checkout a branch for development" 25 helpSummary = "Checkout a branch for development"
diff --git a/subcmds/cherry_pick.py b/subcmds/cherry_pick.py
index 8d81be33..3ad82109 100644
--- a/subcmds/cherry_pick.py
+++ b/subcmds/cherry_pick.py
@@ -22,6 +22,7 @@ from git_command import GitCommand
22 22
23CHANGE_ID_RE = re.compile(r'^\s*Change-Id: I([0-9a-f]{40})\s*$') 23CHANGE_ID_RE = re.compile(r'^\s*Change-Id: I([0-9a-f]{40})\s*$')
24 24
25
25class CherryPick(Command): 26class CherryPick(Command):
26 common = True 27 common = True
27 helpSummary = "Cherry-pick a change." 28 helpSummary = "Cherry-pick a change."
diff --git a/subcmds/diff.py b/subcmds/diff.py
index fa41e70e..406baa28 100644
--- a/subcmds/diff.py
+++ b/subcmds/diff.py
@@ -16,6 +16,7 @@
16 16
17from command import PagedCommand 17from command import PagedCommand
18 18
19
19class Diff(PagedCommand): 20class Diff(PagedCommand):
20 common = True 21 common = True
21 helpSummary = "Show changes between commit and working tree" 22 helpSummary = "Show changes between commit and working tree"
diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py
index 9bdb5e14..77f99df2 100644
--- a/subcmds/diffmanifests.py
+++ b/subcmds/diffmanifests.py
@@ -18,10 +18,12 @@ from color import Coloring
18from command import PagedCommand 18from command import PagedCommand
19from manifest_xml import XmlManifest 19from manifest_xml import XmlManifest
20 20
21
21class _Coloring(Coloring): 22class _Coloring(Coloring):
22 def __init__(self, config): 23 def __init__(self, config):
23 Coloring.__init__(self, config, "status") 24 Coloring.__init__(self, config, "status")
24 25
26
25class Diffmanifests(PagedCommand): 27class Diffmanifests(PagedCommand):
26 """ A command to see logs in projects represented by manifests 28 """ A command to see logs in projects represented by manifests
27 29
diff --git a/subcmds/download.py b/subcmds/download.py
index fbd302aa..87d0ce04 100644
--- a/subcmds/download.py
+++ b/subcmds/download.py
@@ -23,6 +23,7 @@ from error import GitError
23 23
24CHANGE_RE = re.compile(r'^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$') 24CHANGE_RE = re.compile(r'^([1-9][0-9]*)(?:[/\.-]([1-9][0-9]*))?$')
25 25
26
26class Download(Command): 27class Download(Command):
27 common = True 28 common = True
28 helpSummary = "Download and checkout a change" 29 helpSummary = "Download and checkout a change"
diff --git a/subcmds/forall.py b/subcmds/forall.py
index 5d2be91f..dbf26f0b 100644
--- a/subcmds/forall.py
+++ b/subcmds/forall.py
@@ -277,6 +277,7 @@ without iterating through the remaining projects.
277 return 277 return
278 yield [mirror, opt, cmd, shell, cnt, config, project] 278 yield [mirror, opt, cmd, shell, cnt, config, project]
279 279
280
280class WorkerKeyboardInterrupt(Exception): 281class WorkerKeyboardInterrupt(Exception):
281 """ Keyboard interrupt exception for worker processes. """ 282 """ Keyboard interrupt exception for worker processes. """
282 pass 283 pass
@@ -285,6 +286,7 @@ class WorkerKeyboardInterrupt(Exception):
285def InitWorker(): 286def InitWorker():
286 signal.signal(signal.SIGINT, signal.SIG_IGN) 287 signal.signal(signal.SIGINT, signal.SIG_IGN)
287 288
289
288def DoWorkWrapper(args): 290def DoWorkWrapper(args):
289 """ A wrapper around the DoWork() method. 291 """ A wrapper around the DoWork() method.
290 292
@@ -303,6 +305,7 @@ def DoWorkWrapper(args):
303 305
304def DoWork(project, mirror, opt, cmd, shell, cnt, config): 306def DoWork(project, mirror, opt, cmd, shell, cnt, config):
305 env = os.environ.copy() 307 env = os.environ.copy()
308
306 def setenv(name, val): 309 def setenv(name, val):
307 if val is None: 310 if val is None:
308 val = '' 311 val = ''
diff --git a/subcmds/gitc_delete.py b/subcmds/gitc_delete.py
index e5214b8e..1011276f 100644
--- a/subcmds/gitc_delete.py
+++ b/subcmds/gitc_delete.py
@@ -24,6 +24,7 @@ from pyversion import is_python3
24if not is_python3(): 24if not is_python3():
25 input = raw_input 25 input = raw_input
26 26
27
27class GitcDelete(Command, GitcClientCommand): 28class GitcDelete(Command, GitcClientCommand):
28 common = True 29 common = True
29 visible_everywhere = False 30 visible_everywhere = False
diff --git a/subcmds/grep.py b/subcmds/grep.py
index 4dd85d57..13069286 100644
--- a/subcmds/grep.py
+++ b/subcmds/grep.py
@@ -23,12 +23,14 @@ from command import PagedCommand
23from error import GitError 23from error import GitError
24from git_command import git_require, GitCommand 24from git_command import git_require, GitCommand
25 25
26
26class GrepColoring(Coloring): 27class GrepColoring(Coloring):
27 def __init__(self, config): 28 def __init__(self, config):
28 Coloring.__init__(self, config, 'grep') 29 Coloring.__init__(self, config, 'grep')
29 self.project = self.printer('project', attr='bold') 30 self.project = self.printer('project', attr='bold')
30 self.fail = self.printer('fail', fg='red') 31 self.fail = self.printer('fail', fg='red')
31 32
33
32class Grep(PagedCommand): 34class Grep(PagedCommand):
33 common = True 35 common = True
34 helpSummary = "Print lines matching a pattern" 36 helpSummary = "Print lines matching a pattern"
@@ -156,7 +158,6 @@ contain a line that matches both expressions:
156 action='callback', callback=carry, 158 action='callback', callback=carry,
157 help='Show only file names not containing matching lines') 159 help='Show only file names not containing matching lines')
158 160
159
160 def Execute(self, opt, args): 161 def Execute(self, opt, args):
161 out = GrepColoring(self.manifest.manifestProject.config) 162 out = GrepColoring(self.manifest.manifestProject.config)
162 163
diff --git a/subcmds/help.py b/subcmds/help.py
index 93b9a86d..36b3a7ae 100644
--- a/subcmds/help.py
+++ b/subcmds/help.py
@@ -23,6 +23,7 @@ from color import Coloring
23from command import PagedCommand, MirrorSafeCommand, GitcAvailableCommand, GitcClientCommand 23from command import PagedCommand, MirrorSafeCommand, GitcAvailableCommand, GitcClientCommand
24import gitc_utils 24import gitc_utils
25 25
26
26class Help(PagedCommand, MirrorSafeCommand): 27class Help(PagedCommand, MirrorSafeCommand):
27 common = False 28 common = False
28 helpSummary = "Display detailed help on a command" 29 helpSummary = "Display detailed help on a command"
diff --git a/subcmds/info.py b/subcmds/info.py
index 96fa6a4c..76f5d1d6 100644
--- a/subcmds/info.py
+++ b/subcmds/info.py
@@ -18,10 +18,12 @@ from command import PagedCommand
18from color import Coloring 18from color import Coloring
19from git_refs import R_M 19from git_refs import R_M
20 20
21
21class _Coloring(Coloring): 22class _Coloring(Coloring):
22 def __init__(self, config): 23 def __init__(self, config):
23 Coloring.__init__(self, config, "status") 24 Coloring.__init__(self, config, "status")
24 25
26
25class Info(PagedCommand): 27class Info(PagedCommand):
26 common = True 28 common = True
27 helpSummary = "Get info on the manifest branch, current branch or unmerged branches" 29 helpSummary = "Get info on the manifest branch, current branch or unmerged branches"
@@ -41,7 +43,6 @@ class Info(PagedCommand):
41 dest="local", action="store_true", 43 dest="local", action="store_true",
42 help="Disable all remote operations") 44 help="Disable all remote operations")
43 45
44
45 def Execute(self, opt, args): 46 def Execute(self, opt, args):
46 self.out = _Coloring(self.manifest.globalConfig) 47 self.out = _Coloring(self.manifest.globalConfig)
47 self.heading = self.out.printer('heading', attr='bold') 48 self.heading = self.out.printer('heading', attr='bold')
diff --git a/subcmds/init.py b/subcmds/init.py
index 7181b86f..dde97286 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -37,6 +37,7 @@ from git_config import GitConfig
37from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD 37from git_command import git_require, MIN_GIT_VERSION_SOFT, MIN_GIT_VERSION_HARD
38import platform_utils 38import platform_utils
39 39
40
40class Init(InteractiveCommand, MirrorSafeCommand): 41class Init(InteractiveCommand, MirrorSafeCommand):
41 common = True 42 common = True
42 helpSummary = "Initialize repo in the current directory" 43 helpSummary = "Initialize repo in the current directory"
diff --git a/subcmds/list.py b/subcmds/list.py
index 1cd971ef..13cae5ff 100644
--- a/subcmds/list.py
+++ b/subcmds/list.py
@@ -18,6 +18,7 @@ from __future__ import print_function
18 18
19from command import Command, MirrorSafeCommand 19from command import Command, MirrorSafeCommand
20 20
21
21class List(Command, MirrorSafeCommand): 22class List(Command, MirrorSafeCommand):
22 common = True 23 common = True
23 helpSummary = "List projects and their associated directories" 24 helpSummary = "List projects and their associated directories"
diff --git a/subcmds/manifest.py b/subcmds/manifest.py
index 6bb01045..072c9ff7 100644
--- a/subcmds/manifest.py
+++ b/subcmds/manifest.py
@@ -20,6 +20,7 @@ import sys
20 20
21from command import PagedCommand 21from command import PagedCommand
22 22
23
23class Manifest(PagedCommand): 24class Manifest(PagedCommand):
24 common = False 25 common = False
25 helpSummary = "Manifest inspection utility" 26 helpSummary = "Manifest inspection utility"
diff --git a/subcmds/prune.py b/subcmds/prune.py
index ff2fba1d..e90ff213 100644
--- a/subcmds/prune.py
+++ b/subcmds/prune.py
@@ -18,6 +18,7 @@ from __future__ import print_function
18from color import Coloring 18from color import Coloring
19from command import PagedCommand 19from command import PagedCommand
20 20
21
21class Prune(PagedCommand): 22class Prune(PagedCommand):
22 common = True 23 common = True
23 helpSummary = "Prune (delete) already merged topics" 24 helpSummary = "Prune (delete) already merged topics"
diff --git a/subcmds/selfupdate.py b/subcmds/selfupdate.py
index b157e2f1..4817a862 100644
--- a/subcmds/selfupdate.py
+++ b/subcmds/selfupdate.py
@@ -22,6 +22,7 @@ from command import Command, MirrorSafeCommand
22from subcmds.sync import _PostRepoUpgrade 22from subcmds.sync import _PostRepoUpgrade
23from subcmds.sync import _PostRepoFetch 23from subcmds.sync import _PostRepoFetch
24 24
25
25class Selfupdate(Command, MirrorSafeCommand): 26class Selfupdate(Command, MirrorSafeCommand):
26 common = False 27 common = False
27 helpSummary = "Update repo to the latest version" 28 helpSummary = "Update repo to the latest version"
diff --git a/subcmds/smartsync.py b/subcmds/smartsync.py
index 675b9834..6037e5a3 100644
--- a/subcmds/smartsync.py
+++ b/subcmds/smartsync.py
@@ -16,6 +16,7 @@
16 16
17from subcmds.sync import Sync 17from subcmds.sync import Sync
18 18
19
19class Smartsync(Sync): 20class Smartsync(Sync):
20 common = True 21 common = True
21 helpSummary = "Update working tree to the latest known good revision" 22 helpSummary = "Update working tree to the latest known good revision"
diff --git a/subcmds/stage.py b/subcmds/stage.py
index aeb49513..4dce5ce5 100644
--- a/subcmds/stage.py
+++ b/subcmds/stage.py
@@ -21,6 +21,7 @@ from color import Coloring
21from command import InteractiveCommand 21from command import InteractiveCommand
22from git_command import GitCommand 22from git_command import GitCommand
23 23
24
24class _ProjectList(Coloring): 25class _ProjectList(Coloring):
25 def __init__(self, gc): 26 def __init__(self, gc):
26 Coloring.__init__(self, gc, 'interactive') 27 Coloring.__init__(self, gc, 'interactive')
@@ -28,6 +29,7 @@ class _ProjectList(Coloring):
28 self.header = self.printer('header', attr='bold') 29 self.header = self.printer('header', attr='bold')
29 self.help = self.printer('help', fg='red', attr='bold') 30 self.help = self.printer('help', fg='red', attr='bold')
30 31
32
31class Stage(InteractiveCommand): 33class Stage(InteractiveCommand):
32 common = True 34 common = True
33 helpSummary = "Stage file(s) for commit" 35 helpSummary = "Stage file(s) for commit"
@@ -105,6 +107,7 @@ The '%prog' command stages files to prepare the next commit.
105 continue 107 continue
106 print('Bye.') 108 print('Bye.')
107 109
110
108def _AddI(project): 111def _AddI(project):
109 p = GitCommand(project, ['add', '--interactive'], bare=False) 112 p = GitCommand(project, ['add', '--interactive'], bare=False)
110 p.Wait() 113 p.Wait()
diff --git a/subcmds/start.py b/subcmds/start.py
index f98f790a..adc6d293 100644
--- a/subcmds/start.py
+++ b/subcmds/start.py
@@ -25,6 +25,7 @@ import gitc_utils
25from progress import Progress 25from progress import Progress
26from project import SyncBuffer 26from project import SyncBuffer
27 27
28
28class Start(Command): 29class Start(Command):
29 common = True 30 common = True
30 helpSummary = "Start a new branch for development" 31 helpSummary = "Start a new branch for development"
diff --git a/subcmds/status.py b/subcmds/status.py
index a04ba922..b594bd89 100644
--- a/subcmds/status.py
+++ b/subcmds/status.py
@@ -31,6 +31,7 @@ import os
31from color import Coloring 31from color import Coloring
32import platform_utils 32import platform_utils
33 33
34
34class Status(PagedCommand): 35class Status(PagedCommand):
35 common = True 36 common = True
36 helpSummary = "Show the working tree status" 37 helpSummary = "Show the working tree status"
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 1ea102c0..c433ce6f 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -53,6 +53,7 @@ except ImportError:
53 53
54try: 54try:
55 import resource 55 import resource
56
56 def _rlimit_nofile(): 57 def _rlimit_nofile():
57 return resource.getrlimit(resource.RLIMIT_NOFILE) 58 return resource.getrlimit(resource.RLIMIT_NOFILE)
58except ImportError: 59except ImportError:
@@ -81,13 +82,16 @@ from manifest_xml import GitcManifest
81 82
82_ONE_DAY_S = 24 * 60 * 60 83_ONE_DAY_S = 24 * 60 * 60
83 84
85
84class _FetchError(Exception): 86class _FetchError(Exception):
85 """Internal error thrown in _FetchHelper() when we don't want stack trace.""" 87 """Internal error thrown in _FetchHelper() when we don't want stack trace."""
86 pass 88 pass
87 89
90
88class _CheckoutError(Exception): 91class _CheckoutError(Exception):
89 """Internal error thrown in _CheckoutOne() when we don't want stack trace.""" 92 """Internal error thrown in _CheckoutOne() when we don't want stack trace."""
90 93
94
91class Sync(Command, MirrorSafeCommand): 95class Sync(Command, MirrorSafeCommand):
92 jobs = 1 96 jobs = 1
93 common = True 97 common = True
@@ -1044,6 +1048,7 @@ later is required to fix a server side protocol bug.
1044 file=sys.stderr) 1048 file=sys.stderr)
1045 sys.exit(1) 1049 sys.exit(1)
1046 1050
1051
1047def _PostRepoUpgrade(manifest, quiet=False): 1052def _PostRepoUpgrade(manifest, quiet=False):
1048 wrapper = Wrapper() 1053 wrapper = Wrapper()
1049 if wrapper.NeedSetupGnuPG(): 1054 if wrapper.NeedSetupGnuPG():
@@ -1052,6 +1057,7 @@ def _PostRepoUpgrade(manifest, quiet=False):
1052 if project.Exists: 1057 if project.Exists:
1053 project.PostRepoUpgrade() 1058 project.PostRepoUpgrade()
1054 1059
1060
1055def _PostRepoFetch(rp, no_repo_verify=False, verbose=False): 1061def _PostRepoFetch(rp, no_repo_verify=False, verbose=False):
1056 if rp.HasChanges: 1062 if rp.HasChanges:
1057 print('info: A new version of repo is available', file=sys.stderr) 1063 print('info: A new version of repo is available', file=sys.stderr)
@@ -1070,6 +1076,7 @@ def _PostRepoFetch(rp, no_repo_verify=False, verbose=False):
1070 print('repo version %s is current' % rp.work_git.describe(HEAD), 1076 print('repo version %s is current' % rp.work_git.describe(HEAD),
1071 file=sys.stderr) 1077 file=sys.stderr)
1072 1078
1079
1073def _VerifyTag(project): 1080def _VerifyTag(project):
1074 gpg_dir = os.path.expanduser('~/.repoconfig/gnupg') 1081 gpg_dir = os.path.expanduser('~/.repoconfig/gnupg')
1075 if not os.path.exists(gpg_dir): 1082 if not os.path.exists(gpg_dir):
@@ -1174,6 +1181,8 @@ class _FetchTimes(object):
1174# and supporting persistent-http[s]. It cannot change hosts from 1181# and supporting persistent-http[s]. It cannot change hosts from
1175# request to request like the normal transport, the real url 1182# request to request like the normal transport, the real url
1176# is passed during initialization. 1183# is passed during initialization.
1184
1185
1177class PersistentTransport(xmlrpc.client.Transport): 1186class PersistentTransport(xmlrpc.client.Transport):
1178 def __init__(self, orig_host): 1187 def __init__(self, orig_host):
1179 self.orig_host = orig_host 1188 self.orig_host = orig_host
diff --git a/subcmds/upload.py b/subcmds/upload.py
index 180496fc..bc373b3e 100644
--- a/subcmds/upload.py
+++ b/subcmds/upload.py
@@ -33,6 +33,7 @@ else:
33 33
34UNUSUAL_COMMIT_THRESHOLD = 5 34UNUSUAL_COMMIT_THRESHOLD = 5
35 35
36
36def _ConfirmManyUploads(multiple_branches=False): 37def _ConfirmManyUploads(multiple_branches=False):
37 if multiple_branches: 38 if multiple_branches:
38 print('ATTENTION: One or more branches has an unusually high number ' 39 print('ATTENTION: One or more branches has an unusually high number '
@@ -44,17 +45,20 @@ def _ConfirmManyUploads(multiple_branches=False):
44 answer = input("If you are sure you intend to do this, type 'yes': ").strip() 45 answer = input("If you are sure you intend to do this, type 'yes': ").strip()
45 return answer == "yes" 46 return answer == "yes"
46 47
48
47def _die(fmt, *args): 49def _die(fmt, *args):
48 msg = fmt % args 50 msg = fmt % args
49 print('error: %s' % msg, file=sys.stderr) 51 print('error: %s' % msg, file=sys.stderr)
50 sys.exit(1) 52 sys.exit(1)
51 53
54
52def _SplitEmails(values): 55def _SplitEmails(values):
53 result = [] 56 result = []
54 for value in values: 57 for value in values:
55 result.extend([s.strip() for s in value.split(',')]) 58 result.extend([s.strip() for s in value.split(',')])
56 return result 59 return result
57 60
61
58class Upload(InteractiveCommand): 62class Upload(InteractiveCommand):
59 common = True 63 common = True
60 helpSummary = "Upload changes for code review" 64 helpSummary = "Upload changes for code review"
diff --git a/subcmds/version.py b/subcmds/version.py
index 761172b7..92316549 100644
--- a/subcmds/version.py
+++ b/subcmds/version.py
@@ -20,6 +20,7 @@ from command import Command, MirrorSafeCommand
20from git_command import git, RepoSourceVersion, user_agent 20from git_command import git, RepoSourceVersion, user_agent
21from git_refs import HEAD 21from git_refs import HEAD
22 22
23
23class Version(Command, MirrorSafeCommand): 24class Version(Command, MirrorSafeCommand):
24 wrapper_version = None 25 wrapper_version = None
25 wrapper_path = None 26 wrapper_path = None