diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/diffmanifests.py | 21 | ||||
| -rw-r--r-- | subcmds/forall.py | 11 | ||||
| -rw-r--r-- | subcmds/init.py | 11 | ||||
| -rw-r--r-- | subcmds/start.py | 3 | ||||
| -rw-r--r-- | subcmds/sync.py | 2 | ||||
| -rw-r--r-- | subcmds/upload.py | 14 |
6 files changed, 44 insertions, 18 deletions
diff --git a/subcmds/diffmanifests.py b/subcmds/diffmanifests.py index 05998681..751a2026 100644 --- a/subcmds/diffmanifests.py +++ b/subcmds/diffmanifests.py | |||
| @@ -71,6 +71,10 @@ synced and their revisions won't be found. | |||
| 71 | p.add_option('--no-color', | 71 | p.add_option('--no-color', |
| 72 | dest='color', action='store_false', default=True, | 72 | dest='color', action='store_false', default=True, |
| 73 | help='does not display the diff in color.') | 73 | help='does not display the diff in color.') |
| 74 | p.add_option('--pretty-format', | ||
| 75 | dest='pretty_format', action='store', | ||
| 76 | metavar='<FORMAT>', | ||
| 77 | help='print the log using a custom git pretty format string') | ||
| 74 | 78 | ||
| 75 | def _printRawDiff(self, diff): | 79 | def _printRawDiff(self, diff): |
| 76 | for project in diff['added']: | 80 | for project in diff['added']: |
| @@ -92,7 +96,7 @@ synced and their revisions won't be found. | |||
| 92 | otherProject.revisionExpr)) | 96 | otherProject.revisionExpr)) |
| 93 | self.out.nl() | 97 | self.out.nl() |
| 94 | 98 | ||
| 95 | def _printDiff(self, diff, color=True): | 99 | def _printDiff(self, diff, color=True, pretty_format=None): |
| 96 | if diff['added']: | 100 | if diff['added']: |
| 97 | self.out.nl() | 101 | self.out.nl() |
| 98 | self.printText('added projects : \n') | 102 | self.printText('added projects : \n') |
| @@ -124,7 +128,8 @@ synced and their revisions won't be found. | |||
| 124 | self.printText(' to ') | 128 | self.printText(' to ') |
| 125 | self.printRevision(otherProject.revisionExpr) | 129 | self.printRevision(otherProject.revisionExpr) |
| 126 | self.out.nl() | 130 | self.out.nl() |
| 127 | self._printLogs(project, otherProject, raw=False, color=color) | 131 | self._printLogs(project, otherProject, raw=False, color=color, |
| 132 | pretty_format=pretty_format) | ||
| 128 | self.out.nl() | 133 | self.out.nl() |
| 129 | 134 | ||
| 130 | if diff['unreachable']: | 135 | if diff['unreachable']: |
| @@ -139,9 +144,13 @@ synced and their revisions won't be found. | |||
| 139 | self.printText(' not found') | 144 | self.printText(' not found') |
| 140 | self.out.nl() | 145 | self.out.nl() |
| 141 | 146 | ||
| 142 | def _printLogs(self, project, otherProject, raw=False, color=True): | 147 | def _printLogs(self, project, otherProject, raw=False, color=True, |
| 143 | logs = project.getAddedAndRemovedLogs(otherProject, oneline=True, | 148 | pretty_format=None): |
| 144 | color=color) | 149 | |
| 150 | logs = project.getAddedAndRemovedLogs(otherProject, | ||
| 151 | oneline=(pretty_format is None), | ||
| 152 | color=color, | ||
| 153 | pretty_format=pretty_format) | ||
| 145 | if logs['removed']: | 154 | if logs['removed']: |
| 146 | removedLogs = logs['removed'].split('\n') | 155 | removedLogs = logs['removed'].split('\n') |
| 147 | for log in removedLogs: | 156 | for log in removedLogs: |
| @@ -192,4 +201,4 @@ synced and their revisions won't be found. | |||
| 192 | if opt.raw: | 201 | if opt.raw: |
| 193 | self._printRawDiff(diff) | 202 | self._printRawDiff(diff) |
| 194 | else: | 203 | else: |
| 195 | self._printDiff(diff, color=opt.color) | 204 | self._printDiff(diff, color=opt.color, pretty_format=opt.pretty_format) |
diff --git a/subcmds/forall.py b/subcmds/forall.py index b10f34b3..07ee8d58 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
| @@ -120,6 +120,9 @@ without iterating through the remaining projects. | |||
| 120 | p.add_option('-r', '--regex', | 120 | p.add_option('-r', '--regex', |
| 121 | dest='regex', action='store_true', | 121 | dest='regex', action='store_true', |
| 122 | help="Execute the command only on projects matching regex or wildcard expression") | 122 | help="Execute the command only on projects matching regex or wildcard expression") |
| 123 | p.add_option('-i', '--inverse-regex', | ||
| 124 | dest='inverse_regex', action='store_true', | ||
| 125 | help="Execute the command only on projects not matching regex or wildcard expression") | ||
| 123 | p.add_option('-g', '--groups', | 126 | p.add_option('-g', '--groups', |
| 124 | dest='groups', | 127 | dest='groups', |
| 125 | help="Execute the command only on projects matching the specified groups") | 128 | help="Execute the command only on projects matching the specified groups") |
| @@ -215,10 +218,12 @@ without iterating through the remaining projects. | |||
| 215 | if os.path.isfile(smart_sync_manifest_path): | 218 | if os.path.isfile(smart_sync_manifest_path): |
| 216 | self.manifest.Override(smart_sync_manifest_path) | 219 | self.manifest.Override(smart_sync_manifest_path) |
| 217 | 220 | ||
| 218 | if not opt.regex: | 221 | if opt.regex: |
| 219 | projects = self.GetProjects(args, groups=opt.groups) | ||
| 220 | else: | ||
| 221 | projects = self.FindProjects(args) | 222 | projects = self.FindProjects(args) |
| 223 | elif opt.inverse_regex: | ||
| 224 | projects = self.FindProjects(args, inverse=True) | ||
| 225 | else: | ||
| 226 | projects = self.GetProjects(args, groups=opt.groups) | ||
| 222 | 227 | ||
| 223 | os.environ['REPO_COUNT'] = str(len(projects)) | 228 | os.environ['REPO_COUNT'] = str(len(projects)) |
| 224 | 229 | ||
diff --git a/subcmds/init.py b/subcmds/init.py index b8e3de5a..45d69b79 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -61,6 +61,11 @@ directory use as much data as possible from the local reference | |||
| 61 | directory when fetching from the server. This will make the sync | 61 | directory when fetching from the server. This will make the sync |
| 62 | go a lot faster by reducing data traffic on the network. | 62 | go a lot faster by reducing data traffic on the network. |
| 63 | 63 | ||
| 64 | The --no-clone-bundle option disables any attempt to use | ||
| 65 | $URL/clone.bundle to bootstrap a new Git repository from a | ||
| 66 | resumeable bundle file on a content delivery network. This | ||
| 67 | may be necessary if there are problems with the local Python | ||
| 68 | HTTP client or proxy configuration, but the Git binary works. | ||
| 64 | 69 | ||
| 65 | Switching Manifest Branches | 70 | Switching Manifest Branches |
| 66 | --------------------------- | 71 | --------------------------- |
| @@ -113,6 +118,9 @@ to update the working directory files. | |||
| 113 | help='restrict manifest projects to ones with a specified ' | 118 | help='restrict manifest projects to ones with a specified ' |
| 114 | 'platform group [auto|all|none|linux|darwin|...]', | 119 | 'platform group [auto|all|none|linux|darwin|...]', |
| 115 | metavar='PLATFORM') | 120 | metavar='PLATFORM') |
| 121 | g.add_option('--no-clone-bundle', | ||
| 122 | dest='no_clone_bundle', action='store_true', | ||
| 123 | help='disable use of /clone.bundle on HTTP/HTTPS') | ||
| 116 | 124 | ||
| 117 | # Tool | 125 | # Tool |
| 118 | g = p.add_option_group('repo Version options') | 126 | g = p.add_option_group('repo Version options') |
| @@ -222,7 +230,8 @@ to update the working directory files. | |||
| 222 | 'in another location.', file=sys.stderr) | 230 | 'in another location.', file=sys.stderr) |
| 223 | sys.exit(1) | 231 | sys.exit(1) |
| 224 | 232 | ||
| 225 | if not m.Sync_NetworkHalf(is_new=is_new): | 233 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, |
| 234 | clone_bundle=not opt.no_clone_bundle): | ||
| 226 | r = m.GetRemote(m.remote.name) | 235 | r = m.GetRemote(m.remote.name) |
| 227 | print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) | 236 | print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) |
| 228 | 237 | ||
diff --git a/subcmds/start.py b/subcmds/start.py index d1430a9d..290b6897 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
| @@ -54,8 +54,7 @@ revision specified in the manifest. | |||
| 54 | if not opt.all: | 54 | if not opt.all: |
| 55 | projects = args[1:] | 55 | projects = args[1:] |
| 56 | if len(projects) < 1: | 56 | if len(projects) < 1: |
| 57 | print("error: at least one project must be specified", file=sys.stderr) | 57 | projects = ['.',] # start it in the local project by default |
| 58 | sys.exit(1) | ||
| 59 | 58 | ||
| 60 | all_projects = self.GetProjects(projects, | 59 | all_projects = self.GetProjects(projects, |
| 61 | missing_ok=bool(self.gitc_manifest)) | 60 | missing_ok=bool(self.gitc_manifest)) |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 4af411c9..9124a653 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -242,7 +242,7 @@ later is required to fix a server side protocol bug. | |||
| 242 | if show_smart: | 242 | if show_smart: |
| 243 | p.add_option('-s', '--smart-sync', | 243 | p.add_option('-s', '--smart-sync', |
| 244 | dest='smart_sync', action='store_true', | 244 | dest='smart_sync', action='store_true', |
| 245 | help='smart sync using manifest from a known good build') | 245 | help='smart sync using manifest from the latest known good build') |
| 246 | p.add_option('-t', '--smart-tag', | 246 | p.add_option('-t', '--smart-tag', |
| 247 | dest='smart_tag', action='store', | 247 | dest='smart_tag', action='store', |
| 248 | help='smart sync using manifest from a known tag') | 248 | help='smart sync using manifest from a known tag') |
diff --git a/subcmds/upload.py b/subcmds/upload.py index 674fc17d..1172dadc 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
| @@ -454,9 +454,15 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 454 | if avail: | 454 | if avail: |
| 455 | pending.append((project, avail)) | 455 | pending.append((project, avail)) |
| 456 | 456 | ||
| 457 | if pending and (not opt.bypass_hooks): | 457 | if not pending: |
| 458 | print("no branches ready for upload", file=sys.stderr) | ||
| 459 | return | ||
| 460 | |||
| 461 | if not opt.bypass_hooks: | ||
| 458 | hook = RepoHook('pre-upload', self.manifest.repo_hooks_project, | 462 | hook = RepoHook('pre-upload', self.manifest.repo_hooks_project, |
| 459 | self.manifest.topdir, abort_if_user_denies=True) | 463 | self.manifest.topdir, |
| 464 | self.manifest.manifestProject.GetRemote('origin').url, | ||
| 465 | abort_if_user_denies=True) | ||
| 460 | pending_proj_names = [project.name for (project, avail) in pending] | 466 | pending_proj_names = [project.name for (project, avail) in pending] |
| 461 | pending_worktrees = [project.worktree for (project, avail) in pending] | 467 | pending_worktrees = [project.worktree for (project, avail) in pending] |
| 462 | try: | 468 | try: |
| @@ -472,9 +478,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ | |||
| 472 | cc = _SplitEmails(opt.cc) | 478 | cc = _SplitEmails(opt.cc) |
| 473 | people = (reviewers, cc) | 479 | people = (reviewers, cc) |
| 474 | 480 | ||
| 475 | if not pending: | 481 | if len(pending) == 1 and len(pending[0][1]) == 1: |
| 476 | print("no branches ready for upload", file=sys.stderr) | ||
| 477 | elif len(pending) == 1 and len(pending[0][1]) == 1: | ||
| 478 | self._SingleBranch(opt, pending[0][1][0], people) | 482 | self._SingleBranch(opt, pending[0][1][0], people) |
| 479 | else: | 483 | else: |
| 480 | self._MultipleBranches(opt, pending, people) | 484 | self._MultipleBranches(opt, pending, people) |
