diff options
Diffstat (limited to 'subcmds')
-rw-r--r-- | subcmds/download.py | 5 | ||||
-rw-r--r-- | subcmds/init.py | 2 | ||||
-rw-r--r-- | subcmds/stage.py | 4 | ||||
-rw-r--r-- | subcmds/start.py | 10 | ||||
-rw-r--r-- | subcmds/sync.py | 10 | ||||
-rw-r--r-- | subcmds/upload.py | 20 |
6 files changed, 33 insertions, 18 deletions
diff --git a/subcmds/download.py b/subcmds/download.py index a029462e..e1010aa2 100644 --- a/subcmds/download.py +++ b/subcmds/download.py | |||
@@ -26,11 +26,12 @@ class Download(Command): | |||
26 | common = True | 26 | common = True |
27 | helpSummary = "Download and checkout a change" | 27 | helpSummary = "Download and checkout a change" |
28 | helpUsage = """ | 28 | helpUsage = """ |
29 | %prog {project change[/patchset]}... | 29 | %prog {[project] change[/patchset]}... |
30 | """ | 30 | """ |
31 | helpDescription = """ | 31 | helpDescription = """ |
32 | The '%prog' command downloads a change from the review system and | 32 | The '%prog' command downloads a change from the review system and |
33 | makes it available in your project's local working directory. | 33 | makes it available in your project's local working directory. |
34 | If no project is specified try to use current directory as a project. | ||
34 | """ | 35 | """ |
35 | 36 | ||
36 | def _Options(self, p): | 37 | def _Options(self, p): |
@@ -55,7 +56,7 @@ makes it available in your project's local working directory. | |||
55 | m = CHANGE_RE.match(a) | 56 | m = CHANGE_RE.match(a) |
56 | if m: | 57 | if m: |
57 | if not project: | 58 | if not project: |
58 | self.Usage() | 59 | project = self.GetProjects(".")[0] |
59 | chg_id = int(m.group(1)) | 60 | chg_id = int(m.group(1)) |
60 | if m.group(2): | 61 | if m.group(2): |
61 | ps_id = int(m.group(2)) | 62 | ps_id = int(m.group(2)) |
diff --git a/subcmds/init.py b/subcmds/init.py index e6470916..eeddca06 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -256,7 +256,7 @@ to update the working directory files. | |||
256 | sys.exit(1) | 256 | sys.exit(1) |
257 | 257 | ||
258 | if opt.manifest_branch: | 258 | if opt.manifest_branch: |
259 | m.MetaBranchSwitch() | 259 | m.MetaBranchSwitch(submodules=opt.submodules) |
260 | 260 | ||
261 | syncbuf = SyncBuffer(m.config) | 261 | syncbuf = SyncBuffer(m.config) |
262 | m.Sync_LocalHalf(syncbuf, submodules=opt.submodules) | 262 | m.Sync_LocalHalf(syncbuf, submodules=opt.submodules) |
diff --git a/subcmds/stage.py b/subcmds/stage.py index 28849764..9d354268 100644 --- a/subcmds/stage.py +++ b/subcmds/stage.py | |||
@@ -60,8 +60,8 @@ The '%prog' command stages files to prepare the next commit. | |||
60 | out.nl() | 60 | out.nl() |
61 | 61 | ||
62 | for i in range(len(all_projects)): | 62 | for i in range(len(all_projects)): |
63 | p = all_projects[i] | 63 | project = all_projects[i] |
64 | out.write('%3d: %s', i + 1, p.relpath + '/') | 64 | out.write('%3d: %s', i + 1, project.relpath + '/') |
65 | out.nl() | 65 | out.nl() |
66 | out.nl() | 66 | out.nl() |
67 | 67 | ||
diff --git a/subcmds/start.py b/subcmds/start.py index 290b6897..c3ec303e 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
@@ -18,7 +18,7 @@ import os | |||
18 | import sys | 18 | import sys |
19 | 19 | ||
20 | from command import Command | 20 | from command import Command |
21 | from git_config import IsId | 21 | from git_config import IsImmutable |
22 | from git_command import git | 22 | from git_command import git |
23 | import gitc_utils | 23 | import gitc_utils |
24 | from progress import Progress | 24 | from progress import Progress |
@@ -96,11 +96,11 @@ revision specified in the manifest. | |||
96 | project.Sync_LocalHalf(sync_buf) | 96 | project.Sync_LocalHalf(sync_buf) |
97 | project.revisionId = gitc_project.old_revision | 97 | project.revisionId = gitc_project.old_revision |
98 | 98 | ||
99 | # If the current revision is a specific SHA1 then we can't push back | 99 | # If the current revision is immutable, such as a SHA1, a tag or |
100 | # to it; so substitute with dest_branch if defined, or with manifest | 100 | # a change, then we can't push back to it. Substitute with |
101 | # default revision instead. | 101 | # dest_branch, if defined; or with manifest default revision instead. |
102 | branch_merge = '' | 102 | branch_merge = '' |
103 | if IsId(project.revisionExpr): | 103 | if IsImmutable(project.revisionExpr): |
104 | if project.dest_branch: | 104 | if project.dest_branch: |
105 | branch_merge = project.dest_branch | 105 | branch_merge = project.dest_branch |
106 | else: | 106 | else: |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 797fc403..b88c596d 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -356,7 +356,9 @@ later is required to fix a server side protocol bug. | |||
356 | def _Fetch(self, projects, opt): | 356 | def _Fetch(self, projects, opt): |
357 | fetched = set() | 357 | fetched = set() |
358 | lock = _threading.Lock() | 358 | lock = _threading.Lock() |
359 | pm = Progress('Fetching projects', len(projects)) | 359 | pm = Progress('Fetching projects', len(projects), |
360 | print_newline=not(opt.quiet), | ||
361 | always_print_percentage=opt.quiet) | ||
360 | 362 | ||
361 | objdir_project_map = dict() | 363 | objdir_project_map = dict() |
362 | for project in projects: | 364 | for project in projects: |
@@ -393,7 +395,7 @@ later is required to fix a server side protocol bug. | |||
393 | t.join() | 395 | t.join() |
394 | 396 | ||
395 | # If we saw an error, exit with code 1 so that other scripts can check. | 397 | # If we saw an error, exit with code 1 so that other scripts can check. |
396 | if err_event.isSet(): | 398 | if err_event.isSet() and not opt.force_broken: |
397 | print('\nerror: Exited sync due to fetch errors', file=sys.stderr) | 399 | print('\nerror: Exited sync due to fetch errors', file=sys.stderr) |
398 | sys.exit(1) | 400 | sys.exit(1) |
399 | 401 | ||
@@ -779,8 +781,8 @@ later is required to fix a server side protocol bug. | |||
779 | # generate a new args list to represent the opened projects. | 781 | # generate a new args list to represent the opened projects. |
780 | # TODO: make this more reliable -- if there's a project name/path overlap, | 782 | # TODO: make this more reliable -- if there's a project name/path overlap, |
781 | # this may choose the wrong project. | 783 | # this may choose the wrong project. |
782 | args = [os.path.relpath(self.manifest.paths[p].worktree, os.getcwd()) | 784 | args = [os.path.relpath(self.manifest.paths[path].worktree, os.getcwd()) |
783 | for p in opened_projects] | 785 | for path in opened_projects] |
784 | if not args: | 786 | if not args: |
785 | return | 787 | return |
786 | all_projects = self.GetProjects(args, | 788 | all_projects = self.GetProjects(args, |
diff --git a/subcmds/upload.py b/subcmds/upload.py index 1172dadc..61b18bc2 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -154,6 +154,12 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
154 | p.add_option('-d', '--draft', | 154 | p.add_option('-d', '--draft', |
155 | action='store_true', dest='draft', default=False, | 155 | action='store_true', dest='draft', default=False, |
156 | help='If specified, upload as a draft.') | 156 | help='If specified, upload as a draft.') |
157 | p.add_option('-p', '--private', | ||
158 | action='store_true', dest='private', default=False, | ||
159 | help='If specified, upload as a private change.') | ||
160 | p.add_option('-w', '--wip', | ||
161 | action='store_true', dest='wip', default=False, | ||
162 | help='If specified, upload as a work-in-progress change.') | ||
157 | p.add_option('-D', '--destination', '--dest', | 163 | p.add_option('-D', '--destination', '--dest', |
158 | type='string', action='store', dest='dest_branch', | 164 | type='string', action='store', dest='dest_branch', |
159 | metavar='BRANCH', | 165 | metavar='BRANCH', |
@@ -198,7 +204,8 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
198 | commit_list = branch.commits | 204 | commit_list = branch.commits |
199 | 205 | ||
200 | destination = opt.dest_branch or project.dest_branch or project.revisionExpr | 206 | destination = opt.dest_branch or project.dest_branch or project.revisionExpr |
201 | print('Upload project %s/ to remote branch %s:' % (project.relpath, destination)) | 207 | print('Upload project %s/ to remote branch %s%s:' % |
208 | (project.relpath, destination, ' (draft)' if opt.draft else '')) | ||
202 | print(' branch %s (%2d commit%s, %s):' % ( | 209 | print(' branch %s (%2d commit%s, %s):' % ( |
203 | name, | 210 | name, |
204 | len(commit_list), | 211 | len(commit_list), |
@@ -377,7 +384,12 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
377 | branch.uploaded = False | 384 | branch.uploaded = False |
378 | continue | 385 | continue |
379 | 386 | ||
380 | branch.UploadForReview(people, auto_topic=opt.auto_topic, draft=opt.draft, dest_branch=destination) | 387 | branch.UploadForReview(people, |
388 | auto_topic=opt.auto_topic, | ||
389 | draft=opt.draft, | ||
390 | private=opt.private, | ||
391 | wip=opt.wip, | ||
392 | dest_branch=destination) | ||
381 | branch.uploaded = True | 393 | branch.uploaded = True |
382 | except UploadError as e: | 394 | except UploadError as e: |
383 | branch.error = e | 395 | branch.error = e |
@@ -463,8 +475,8 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
463 | self.manifest.topdir, | 475 | self.manifest.topdir, |
464 | self.manifest.manifestProject.GetRemote('origin').url, | 476 | self.manifest.manifestProject.GetRemote('origin').url, |
465 | abort_if_user_denies=True) | 477 | abort_if_user_denies=True) |
466 | pending_proj_names = [project.name for (project, avail) in pending] | 478 | pending_proj_names = [project.name for (project, available) in pending] |
467 | pending_worktrees = [project.worktree for (project, avail) in pending] | 479 | pending_worktrees = [project.worktree for (project, available) in pending] |
468 | try: | 480 | try: |
469 | hook.Run(opt.allow_all_hooks, project_list=pending_proj_names, | 481 | hook.Run(opt.allow_all_hooks, project_list=pending_proj_names, |
470 | worktree_list=pending_worktrees) | 482 | worktree_list=pending_worktrees) |