diff options
Diffstat (limited to 'subcmds')
| -rw-r--r-- | subcmds/__init__.py | 2 | ||||
| -rw-r--r-- | subcmds/abandon.py | 2 | ||||
| -rw-r--r-- | subcmds/forall.py | 40 | ||||
| -rw-r--r-- | subcmds/help.py | 8 | ||||
| -rw-r--r-- | subcmds/info.py | 10 | ||||
| -rw-r--r-- | subcmds/init.py | 10 | ||||
| -rw-r--r-- | subcmds/rebase.py | 6 | ||||
| -rw-r--r-- | subcmds/start.py | 2 | ||||
| -rw-r--r-- | subcmds/status.py | 8 | ||||
| -rw-r--r-- | subcmds/sync.py | 40 | ||||
| -rw-r--r-- | subcmds/upload.py | 22 |
11 files changed, 75 insertions, 75 deletions
diff --git a/subcmds/__init__.py b/subcmds/__init__.py index 27341038..9cc94718 100644 --- a/subcmds/__init__.py +++ b/subcmds/__init__.py | |||
| @@ -40,7 +40,7 @@ for py in os.listdir(my_dir): | |||
| 40 | cmd = getattr(mod, clsn)() | 40 | cmd = getattr(mod, clsn)() |
| 41 | except AttributeError: | 41 | except AttributeError: |
| 42 | raise SyntaxError('%s/%s does not define class %s' % ( | 42 | raise SyntaxError('%s/%s does not define class %s' % ( |
| 43 | __name__, py, clsn)) | 43 | __name__, py, clsn)) |
| 44 | 44 | ||
| 45 | name = name.replace('_', '-') | 45 | name = name.replace('_', '-') |
| 46 | cmd.NAME = name | 46 | cmd.NAME = name |
diff --git a/subcmds/abandon.py b/subcmds/abandon.py index ba4ef099..9a645c0a 100644 --- a/subcmds/abandon.py +++ b/subcmds/abandon.py | |||
| @@ -95,5 +95,5 @@ It is equivalent to "git branch -D <branchname>". | |||
| 95 | result = "all project" | 95 | result = "all project" |
| 96 | else: | 96 | else: |
| 97 | result = "%s" % ( | 97 | result = "%s" % ( |
| 98 | ('\n' + ' ' * width + '| ').join(p.relpath for p in success[br])) | 98 | ('\n' + ' ' * width + '| ').join(p.relpath for p in success[br])) |
| 99 | print("%s%s| %s\n" % (br, ' ' * (width - len(br)), result), file=sys.stderr) | 99 | print("%s%s| %s\n" % (br, ' ' * (width - len(br)), result), file=sys.stderr) |
diff --git a/subcmds/forall.py b/subcmds/forall.py index 97067605..5d2be91f 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
| @@ -28,10 +28,10 @@ from command import Command, MirrorSafeCommand | |||
| 28 | import platform_utils | 28 | import platform_utils |
| 29 | 29 | ||
| 30 | _CAN_COLOR = [ | 30 | _CAN_COLOR = [ |
| 31 | 'branch', | 31 | 'branch', |
| 32 | 'diff', | 32 | 'diff', |
| 33 | 'grep', | 33 | 'grep', |
| 34 | 'log', | 34 | 'log', |
| 35 | ] | 35 | ] |
| 36 | 36 | ||
| 37 | 37 | ||
| @@ -170,14 +170,14 @@ without iterating through the remaining projects. | |||
| 170 | else: | 170 | else: |
| 171 | lrev = None | 171 | lrev = None |
| 172 | return { | 172 | return { |
| 173 | 'name': project.name, | 173 | 'name': project.name, |
| 174 | 'relpath': project.relpath, | 174 | 'relpath': project.relpath, |
| 175 | 'remote_name': project.remote.name, | 175 | 'remote_name': project.remote.name, |
| 176 | 'lrev': lrev, | 176 | 'lrev': lrev, |
| 177 | 'rrev': project.revisionExpr, | 177 | 'rrev': project.revisionExpr, |
| 178 | 'annotations': dict((a.name, a.value) for a in project.annotations), | 178 | 'annotations': dict((a.name, a.value) for a in project.annotations), |
| 179 | 'gitdir': project.gitdir, | 179 | 'gitdir': project.gitdir, |
| 180 | 'worktree': project.worktree, | 180 | 'worktree': project.worktree, |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | def ValidateOptions(self, opt, args): | 183 | def ValidateOptions(self, opt, args): |
| @@ -196,8 +196,8 @@ without iterating through the remaining projects. | |||
| 196 | cmd.extend(opt.command[1:]) | 196 | cmd.extend(opt.command[1:]) |
| 197 | 197 | ||
| 198 | if opt.project_header \ | 198 | if opt.project_header \ |
| 199 | and not shell \ | 199 | and not shell \ |
| 200 | and cmd[0] == 'git': | 200 | and cmd[0] == 'git': |
| 201 | # If this is a direct git command that can enable colorized | 201 | # If this is a direct git command that can enable colorized |
| 202 | # output and the user prefers coloring, add --color into the | 202 | # output and the user prefers coloring, add --color into the |
| 203 | # command line because we are going to wrap the command into | 203 | # command line because we are going to wrap the command into |
| @@ -220,7 +220,7 @@ without iterating through the remaining projects. | |||
| 220 | 220 | ||
| 221 | smart_sync_manifest_name = "smart_sync_override.xml" | 221 | smart_sync_manifest_name = "smart_sync_override.xml" |
| 222 | smart_sync_manifest_path = os.path.join( | 222 | smart_sync_manifest_path = os.path.join( |
| 223 | self.manifest.manifestProject.worktree, smart_sync_manifest_name) | 223 | self.manifest.manifestProject.worktree, smart_sync_manifest_name) |
| 224 | 224 | ||
| 225 | if os.path.isfile(smart_sync_manifest_path): | 225 | if os.path.isfile(smart_sync_manifest_path): |
| 226 | self.manifest.Override(smart_sync_manifest_path) | 226 | self.manifest.Override(smart_sync_manifest_path) |
| @@ -238,8 +238,8 @@ without iterating through the remaining projects. | |||
| 238 | try: | 238 | try: |
| 239 | config = self.manifest.manifestProject.config | 239 | config = self.manifest.manifestProject.config |
| 240 | results_it = pool.imap( | 240 | results_it = pool.imap( |
| 241 | DoWorkWrapper, | 241 | DoWorkWrapper, |
| 242 | self.ProjectArgs(projects, mirror, opt, cmd, shell, config)) | 242 | self.ProjectArgs(projects, mirror, opt, cmd, shell, config)) |
| 243 | pool.close() | 243 | pool.close() |
| 244 | for r in results_it: | 244 | for r in results_it: |
| 245 | rc = rc or r | 245 | rc = rc or r |
| @@ -253,7 +253,7 @@ without iterating through the remaining projects. | |||
| 253 | except Exception as e: | 253 | except Exception as e: |
| 254 | # Catch any other exceptions raised | 254 | # Catch any other exceptions raised |
| 255 | print('Got an error, terminating the pool: %s: %s' % | 255 | print('Got an error, terminating the pool: %s: %s' % |
| 256 | (type(e).__name__, e), | 256 | (type(e).__name__, e), |
| 257 | file=sys.stderr) | 257 | file=sys.stderr) |
| 258 | pool.terminate() | 258 | pool.terminate() |
| 259 | rc = rc or getattr(e, 'errno', 1) | 259 | rc = rc or getattr(e, 'errno', 1) |
| @@ -268,7 +268,7 @@ without iterating through the remaining projects. | |||
| 268 | project = self._SerializeProject(p) | 268 | project = self._SerializeProject(p) |
| 269 | except Exception as e: | 269 | except Exception as e: |
| 270 | print('Project list error on project %s: %s: %s' % | 270 | print('Project list error on project %s: %s: %s' % |
| 271 | (p.name, type(e).__name__, e), | 271 | (p.name, type(e).__name__, e), |
| 272 | file=sys.stderr) | 272 | file=sys.stderr) |
| 273 | return | 273 | return |
| 274 | except KeyboardInterrupt: | 274 | except KeyboardInterrupt: |
| @@ -331,7 +331,7 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config): | |||
| 331 | if opt.ignore_missing: | 331 | if opt.ignore_missing: |
| 332 | return 0 | 332 | return 0 |
| 333 | if ((opt.project_header and opt.verbose) | 333 | if ((opt.project_header and opt.verbose) |
| 334 | or not opt.project_header): | 334 | or not opt.project_header): |
| 335 | print('skipping %s/' % project['relpath'], file=sys.stderr) | 335 | print('skipping %s/' % project['relpath'], file=sys.stderr) |
| 336 | return 1 | 336 | return 1 |
| 337 | 337 | ||
diff --git a/subcmds/help.py b/subcmds/help.py index 78930502..93b9a86d 100644 --- a/subcmds/help.py +++ b/subcmds/help.py | |||
| @@ -72,13 +72,13 @@ Displays detailed usage information about a command. | |||
| 72 | return False | 72 | return False |
| 73 | 73 | ||
| 74 | commandNames = list(sorted([name | 74 | commandNames = list(sorted([name |
| 75 | for name, command in self.commands.items() | 75 | for name, command in self.commands.items() |
| 76 | if command.common and gitc_supported(command)])) | 76 | if command.common and gitc_supported(command)])) |
| 77 | self._PrintCommands(commandNames) | 77 | self._PrintCommands(commandNames) |
| 78 | 78 | ||
| 79 | print( | 79 | print( |
| 80 | "See 'repo help <command>' for more information on a specific command.\n" | 80 | "See 'repo help <command>' for more information on a specific command.\n" |
| 81 | "See 'repo help --all' for a complete list of recognized commands.") | 81 | "See 'repo help --all' for a complete list of recognized commands.") |
| 82 | 82 | ||
| 83 | def _PrintCommandHelp(self, cmd, header_prefix=''): | 83 | def _PrintCommandHelp(self, cmd, header_prefix=''): |
| 84 | class _Out(Coloring): | 84 | class _Out(Coloring): |
diff --git a/subcmds/info.py b/subcmds/info.py index a6faf16a..96fa6a4c 100644 --- a/subcmds/info.py +++ b/subcmds/info.py | |||
| @@ -195,11 +195,11 @@ class Info(PagedCommand): | |||
| 195 | commits = branch.commits | 195 | commits = branch.commits |
| 196 | date = branch.date | 196 | date = branch.date |
| 197 | self.text('%s %-33s (%2d commit%s, %s)' % ( | 197 | self.text('%s %-33s (%2d commit%s, %s)' % ( |
| 198 | branch.name == project.CurrentBranch and '*' or ' ', | 198 | branch.name == project.CurrentBranch and '*' or ' ', |
| 199 | branch.name, | 199 | branch.name, |
| 200 | len(commits), | 200 | len(commits), |
| 201 | len(commits) != 1 and 's' or '', | 201 | len(commits) != 1 and 's' or '', |
| 202 | date)) | 202 | date)) |
| 203 | self.out.nl() | 203 | self.out.nl() |
| 204 | 204 | ||
| 205 | for commit in commits: | 205 | for commit in commits: |
diff --git a/subcmds/init.py b/subcmds/init.py index 191f02b2..7181b86f 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
| @@ -223,7 +223,7 @@ to update the working directory files. | |||
| 223 | platformize = lambda x: 'platform-' + x | 223 | platformize = lambda x: 'platform-' + x |
| 224 | if opt.platform == 'auto': | 224 | if opt.platform == 'auto': |
| 225 | if (not opt.mirror and | 225 | if (not opt.mirror and |
| 226 | not m.config.GetString('repo.mirror') == 'true'): | 226 | not m.config.GetString('repo.mirror') == 'true'): |
| 227 | groups.append(platformize(platform.system().lower())) | 227 | groups.append(platformize(platform.system().lower())) |
| 228 | elif opt.platform == 'all': | 228 | elif opt.platform == 'all': |
| 229 | groups.extend(map(platformize, all_platforms)) | 229 | groups.extend(map(platformize, all_platforms)) |
| @@ -280,10 +280,10 @@ to update the working directory files. | |||
| 280 | m.config.SetString('repo.submodules', 'true') | 280 | m.config.SetString('repo.submodules', 'true') |
| 281 | 281 | ||
| 282 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, | 282 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, |
| 283 | clone_bundle=not opt.no_clone_bundle, | 283 | clone_bundle=not opt.no_clone_bundle, |
| 284 | current_branch_only=opt.current_branch_only, | 284 | current_branch_only=opt.current_branch_only, |
| 285 | no_tags=opt.no_tags, submodules=opt.submodules, | 285 | no_tags=opt.no_tags, submodules=opt.submodules, |
| 286 | clone_filter=opt.clone_filter): | 286 | clone_filter=opt.clone_filter): |
| 287 | r = m.GetRemote(m.remote.name) | 287 | r = m.GetRemote(m.remote.name) |
| 288 | print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) | 288 | print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) |
| 289 | 289 | ||
diff --git a/subcmds/rebase.py b/subcmds/rebase.py index dcb8b2a3..eb92a3c7 100644 --- a/subcmds/rebase.py +++ b/subcmds/rebase.py | |||
| @@ -43,8 +43,8 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 43 | 43 | ||
| 44 | def _Options(self, p): | 44 | def _Options(self, p): |
| 45 | p.add_option('-i', '--interactive', | 45 | p.add_option('-i', '--interactive', |
| 46 | dest="interactive", action="store_true", | 46 | dest="interactive", action="store_true", |
| 47 | help="interactive rebase (single project only)") | 47 | help="interactive rebase (single project only)") |
| 48 | 48 | ||
| 49 | p.add_option('--fail-fast', | 49 | p.add_option('--fail-fast', |
| 50 | dest='fail_fast', action='store_true', | 50 | dest='fail_fast', action='store_true', |
| @@ -82,7 +82,7 @@ branch but need to incorporate new upstream changes "underneath" them. | |||
| 82 | file=sys.stderr) | 82 | file=sys.stderr) |
| 83 | if len(args) == 1: | 83 | if len(args) == 1: |
| 84 | print('note: project %s is mapped to more than one path' % (args[0],), | 84 | print('note: project %s is mapped to more than one path' % (args[0],), |
| 85 | file=sys.stderr) | 85 | file=sys.stderr) |
| 86 | return 1 | 86 | return 1 |
| 87 | 87 | ||
| 88 | # Setup the common git rebase args that we use for all projects. | 88 | # Setup the common git rebase args that we use for all projects. |
diff --git a/subcmds/start.py b/subcmds/start.py index 9b810865..f98f790a 100644 --- a/subcmds/start.py +++ b/subcmds/start.py | |||
| @@ -113,7 +113,7 @@ revision specified in the manifest. | |||
| 113 | branch_merge = self.manifest.default.revisionExpr | 113 | branch_merge = self.manifest.default.revisionExpr |
| 114 | 114 | ||
| 115 | if not project.StartBranch( | 115 | if not project.StartBranch( |
| 116 | nb, branch_merge=branch_merge, revision=opt.revision): | 116 | nb, branch_merge=branch_merge, revision=opt.revision): |
| 117 | err.append(project) | 117 | err.append(project) |
| 118 | pm.end() | 118 | pm.end() |
| 119 | 119 | ||
diff --git a/subcmds/status.py b/subcmds/status.py index 6012ae24..a04ba922 100644 --- a/subcmds/status.py +++ b/subcmds/status.py | |||
| @@ -126,8 +126,8 @@ the following meanings: | |||
| 126 | continue | 126 | continue |
| 127 | if item in proj_dirs_parents: | 127 | if item in proj_dirs_parents: |
| 128 | self._FindOrphans(glob.glob('%s/.*' % item) + | 128 | self._FindOrphans(glob.glob('%s/.*' % item) + |
| 129 | glob.glob('%s/*' % item), | 129 | glob.glob('%s/*' % item), |
| 130 | proj_dirs, proj_dirs_parents, outstring) | 130 | proj_dirs, proj_dirs_parents, outstring) |
| 131 | continue | 131 | continue |
| 132 | outstring.append(''.join([status_header, item, '/'])) | 132 | outstring.append(''.join([status_header, item, '/'])) |
| 133 | 133 | ||
| @@ -179,8 +179,8 @@ the following meanings: | |||
| 179 | 179 | ||
| 180 | outstring = [] | 180 | outstring = [] |
| 181 | self._FindOrphans(glob.glob('.*') + | 181 | self._FindOrphans(glob.glob('.*') + |
| 182 | glob.glob('*'), | 182 | glob.glob('*'), |
| 183 | proj_dirs, proj_dirs_parents, outstring) | 183 | proj_dirs, proj_dirs_parents, outstring) |
| 184 | 184 | ||
| 185 | if outstring: | 185 | if outstring: |
| 186 | output = StatusColoring(self.manifest.globalConfig) | 186 | output = StatusColoring(self.manifest.globalConfig) |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 9e4c7750..1ea102c0 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -327,14 +327,14 @@ later is required to fix a server side protocol bug. | |||
| 327 | try: | 327 | try: |
| 328 | try: | 328 | try: |
| 329 | success = project.Sync_NetworkHalf( | 329 | success = project.Sync_NetworkHalf( |
| 330 | quiet=opt.quiet, | 330 | quiet=opt.quiet, |
| 331 | current_branch_only=opt.current_branch_only, | 331 | current_branch_only=opt.current_branch_only, |
| 332 | force_sync=opt.force_sync, | 332 | force_sync=opt.force_sync, |
| 333 | clone_bundle=not opt.no_clone_bundle, | 333 | clone_bundle=not opt.no_clone_bundle, |
| 334 | no_tags=opt.no_tags, archive=self.manifest.IsArchive, | 334 | no_tags=opt.no_tags, archive=self.manifest.IsArchive, |
| 335 | optimized_fetch=opt.optimized_fetch, | 335 | optimized_fetch=opt.optimized_fetch, |
| 336 | prune=opt.prune, | 336 | prune=opt.prune, |
| 337 | clone_filter=clone_filter) | 337 | clone_filter=clone_filter) |
| 338 | self._fetch_times.Set(project, time.time() - start) | 338 | self._fetch_times.Set(project, time.time() - start) |
| 339 | 339 | ||
| 340 | # Lock around all the rest of the code, since printing, updating a set | 340 | # Lock around all the rest of the code, since printing, updating a set |
| @@ -356,7 +356,7 @@ later is required to fix a server side protocol bug. | |||
| 356 | pass | 356 | pass |
| 357 | except Exception as e: | 357 | except Exception as e: |
| 358 | print('error: Cannot fetch %s (%s: %s)' | 358 | print('error: Cannot fetch %s (%s: %s)' |
| 359 | % (project.name, type(e).__name__, str(e)), file=sys.stderr) | 359 | % (project.name, type(e).__name__, str(e)), file=sys.stderr) |
| 360 | err_event.set() | 360 | err_event.set() |
| 361 | raise | 361 | raise |
| 362 | finally: | 362 | finally: |
| @@ -704,16 +704,16 @@ later is required to fix a server side protocol bug. | |||
| 704 | gitdir = os.path.join(self.manifest.topdir, path, '.git') | 704 | gitdir = os.path.join(self.manifest.topdir, path, '.git') |
| 705 | if os.path.exists(gitdir): | 705 | if os.path.exists(gitdir): |
| 706 | project = Project( | 706 | project = Project( |
| 707 | manifest=self.manifest, | 707 | manifest=self.manifest, |
| 708 | name=path, | 708 | name=path, |
| 709 | remote=RemoteSpec('origin'), | 709 | remote=RemoteSpec('origin'), |
| 710 | gitdir=gitdir, | 710 | gitdir=gitdir, |
| 711 | objdir=gitdir, | 711 | objdir=gitdir, |
| 712 | worktree=os.path.join(self.manifest.topdir, path), | 712 | worktree=os.path.join(self.manifest.topdir, path), |
| 713 | relpath=path, | 713 | relpath=path, |
| 714 | revisionExpr='HEAD', | 714 | revisionExpr='HEAD', |
| 715 | revisionId=None, | 715 | revisionId=None, |
| 716 | groups=None) | 716 | groups=None) |
| 717 | 717 | ||
| 718 | if project.IsDirty() and opt.force_remove_dirty: | 718 | if project.IsDirty() and opt.force_remove_dirty: |
| 719 | print('WARNING: Removing dirty project "%s": uncommitted changes ' | 719 | print('WARNING: Removing dirty project "%s": uncommitted changes ' |
| @@ -885,7 +885,7 @@ later is required to fix a server side protocol bug. | |||
| 885 | 885 | ||
| 886 | manifest_name = opt.manifest_name | 886 | manifest_name = opt.manifest_name |
| 887 | smart_sync_manifest_path = os.path.join( | 887 | smart_sync_manifest_path = os.path.join( |
| 888 | self.manifest.manifestProject.worktree, 'smart_sync_override.xml') | 888 | self.manifest.manifestProject.worktree, 'smart_sync_override.xml') |
| 889 | 889 | ||
| 890 | if opt.smart_sync or opt.smart_tag: | 890 | if opt.smart_sync or opt.smart_tag: |
| 891 | manifest_name = self._SmartSyncSetup(opt, smart_sync_manifest_path) | 891 | manifest_name = self._SmartSyncSetup(opt, smart_sync_manifest_path) |
diff --git a/subcmds/upload.py b/subcmds/upload.py index c0f870eb..180496fc 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
| @@ -218,10 +218,10 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
| 218 | print('Upload project %s/ to remote branch %s%s:' % | 218 | print('Upload project %s/ to remote branch %s%s:' % |
| 219 | (project.relpath, destination, ' (draft)' if opt.draft else '')) | 219 | (project.relpath, destination, ' (draft)' if opt.draft else '')) |
| 220 | print(' branch %s (%2d commit%s, %s):' % ( | 220 | print(' branch %s (%2d commit%s, %s):' % ( |
| 221 | name, | 221 | name, |
| 222 | len(commit_list), | 222 | len(commit_list), |
| 223 | len(commit_list) != 1 and 's' or '', | 223 | len(commit_list) != 1 and 's' or '', |
| 224 | date)) | 224 | date)) |
| 225 | for commit in commit_list: | 225 | for commit in commit_list: |
| 226 | print(' %s' % commit) | 226 | print(' %s' % commit) |
| 227 | 227 | ||
| @@ -422,18 +422,18 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
| 422 | else: | 422 | else: |
| 423 | fmt = '\n (%s)' | 423 | fmt = '\n (%s)' |
| 424 | print(('[FAILED] %-15s %-15s' + fmt) % ( | 424 | print(('[FAILED] %-15s %-15s' + fmt) % ( |
| 425 | branch.project.relpath + '/', | 425 | branch.project.relpath + '/', |
| 426 | branch.name, | 426 | branch.name, |
| 427 | str(branch.error)), | 427 | str(branch.error)), |
| 428 | file=sys.stderr) | 428 | file=sys.stderr) |
| 429 | print() | 429 | print() |
| 430 | 430 | ||
| 431 | for branch in todo: | 431 | for branch in todo: |
| 432 | if branch.uploaded: | 432 | if branch.uploaded: |
| 433 | print('[OK ] %-15s %s' % ( | 433 | print('[OK ] %-15s %s' % ( |
| 434 | branch.project.relpath + '/', | 434 | branch.project.relpath + '/', |
| 435 | branch.name), | 435 | branch.name), |
| 436 | file=sys.stderr) | 436 | file=sys.stderr) |
| 437 | 437 | ||
| 438 | if have_errors: | 438 | if have_errors: |
| 439 | sys.exit(1) | 439 | sys.exit(1) |
