diff options
-rw-r--r-- | editor.py | 6 | ||||
-rw-r--r-- | git_command.py | 8 | ||||
-rw-r--r-- | git_config.py | 20 | ||||
-rw-r--r-- | gitc_utils.py | 2 | ||||
-rwxr-xr-x | main.py | 16 | ||||
-rw-r--r-- | manifest_xml.py | 26 | ||||
-rw-r--r-- | progress.py | 36 | ||||
-rw-r--r-- | project.py | 2 | ||||
-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 |
19 files changed, 133 insertions, 133 deletions
@@ -57,7 +57,7 @@ class Editor(object): | |||
57 | 57 | ||
58 | if os.getenv('TERM') == 'dumb': | 58 | if os.getenv('TERM') == 'dumb': |
59 | print( | 59 | print( |
60 | """No editor specified in GIT_EDITOR, core.editor, VISUAL or EDITOR. | 60 | """No editor specified in GIT_EDITOR, core.editor, VISUAL or EDITOR. |
61 | Tried to fall back to vi but terminal is dumb. Please configure at | 61 | Tried to fall back to vi but terminal is dumb. Please configure at |
62 | least one of these before using this command.""", file=sys.stderr) | 62 | least one of these before using this command.""", file=sys.stderr) |
63 | sys.exit(1) | 63 | sys.exit(1) |
@@ -104,10 +104,10 @@ least one of these before using this command.""", file=sys.stderr) | |||
104 | rc = subprocess.Popen(args, shell=shell).wait() | 104 | rc = subprocess.Popen(args, shell=shell).wait() |
105 | except OSError as e: | 105 | except OSError as e: |
106 | raise EditorError('editor failed, %s: %s %s' | 106 | raise EditorError('editor failed, %s: %s %s' |
107 | % (str(e), editor, path)) | 107 | % (str(e), editor, path)) |
108 | if rc != 0: | 108 | if rc != 0: |
109 | raise EditorError('editor failed with exit status %d: %s %s' | 109 | raise EditorError('editor failed with exit status %d: %s %s' |
110 | % (rc, editor, path)) | 110 | % (rc, editor, path)) |
111 | 111 | ||
112 | with open(path, mode='rb') as fd2: | 112 | with open(path, mode='rb') as fd2: |
113 | return fd2.read().decode('utf-8') | 113 | return fd2.read().decode('utf-8') |
diff --git a/git_command.py b/git_command.py index 5034ae12..df39ec09 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -57,16 +57,16 @@ def ssh_sock(create=True): | |||
57 | if not os.path.exists(tmp_dir): | 57 | if not os.path.exists(tmp_dir): |
58 | tmp_dir = tempfile.gettempdir() | 58 | tmp_dir = tempfile.gettempdir() |
59 | _ssh_sock_path = os.path.join( | 59 | _ssh_sock_path = os.path.join( |
60 | tempfile.mkdtemp('', 'ssh-', tmp_dir), | 60 | tempfile.mkdtemp('', 'ssh-', tmp_dir), |
61 | 'master-%r@%h:%p') | 61 | 'master-%r@%h:%p') |
62 | return _ssh_sock_path | 62 | return _ssh_sock_path |
63 | 63 | ||
64 | def _ssh_proxy(): | 64 | def _ssh_proxy(): |
65 | global _ssh_proxy_path | 65 | global _ssh_proxy_path |
66 | if _ssh_proxy_path is None: | 66 | if _ssh_proxy_path is None: |
67 | _ssh_proxy_path = os.path.join( | 67 | _ssh_proxy_path = os.path.join( |
68 | os.path.dirname(__file__), | 68 | os.path.dirname(__file__), |
69 | 'git_ssh') | 69 | 'git_ssh') |
70 | return _ssh_proxy_path | 70 | return _ssh_proxy_path |
71 | 71 | ||
72 | def _add_ssh_client(p): | 72 | def _add_ssh_client(p): |
diff --git a/git_config.py b/git_config.py index 6b47456f..13fbda24 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -104,8 +104,8 @@ class GitConfig(object): | |||
104 | self._json = jsonFile | 104 | self._json = jsonFile |
105 | if self._json is None: | 105 | if self._json is None: |
106 | self._json = os.path.join( | 106 | self._json = os.path.join( |
107 | os.path.dirname(self.file), | 107 | os.path.dirname(self.file), |
108 | '.repo_' + os.path.basename(self.file) + '.json') | 108 | '.repo_' + os.path.basename(self.file) + '.json') |
109 | 109 | ||
110 | def Has(self, name, include_defaults=True): | 110 | def Has(self, name, include_defaults=True): |
111 | """Return true if this configuration file has the key. | 111 | """Return true if this configuration file has the key. |
@@ -269,7 +269,7 @@ class GitConfig(object): | |||
269 | def _ReadJson(self): | 269 | def _ReadJson(self): |
270 | try: | 270 | try: |
271 | if os.path.getmtime(self._json) \ | 271 | if os.path.getmtime(self._json) \ |
272 | <= os.path.getmtime(self.file): | 272 | <= os.path.getmtime(self.file): |
273 | platform_utils.remove(self._json) | 273 | platform_utils.remove(self._json) |
274 | return None | 274 | return None |
275 | except OSError: | 275 | except OSError: |
@@ -422,16 +422,16 @@ def _open_ssh(host, port=None): | |||
422 | return True | 422 | return True |
423 | 423 | ||
424 | if not _ssh_master \ | 424 | if not _ssh_master \ |
425 | or 'GIT_SSH' in os.environ \ | 425 | or 'GIT_SSH' in os.environ \ |
426 | or sys.platform in ('win32', 'cygwin'): | 426 | or sys.platform in ('win32', 'cygwin'): |
427 | # failed earlier, or cygwin ssh can't do this | 427 | # failed earlier, or cygwin ssh can't do this |
428 | # | 428 | # |
429 | return False | 429 | return False |
430 | 430 | ||
431 | # We will make two calls to ssh; this is the common part of both calls. | 431 | # We will make two calls to ssh; this is the common part of both calls. |
432 | command_base = ['ssh', | 432 | command_base = ['ssh', |
433 | '-o', 'ControlPath %s' % ssh_sock(), | 433 | '-o', 'ControlPath %s' % ssh_sock(), |
434 | host] | 434 | host] |
435 | if port is not None: | 435 | if port is not None: |
436 | command_base[1:1] = ['-p', str(port)] | 436 | command_base[1:1] = ['-p', str(port)] |
437 | 437 | ||
@@ -465,7 +465,7 @@ def _open_ssh(host, port=None): | |||
465 | except Exception as e: | 465 | except Exception as e: |
466 | _ssh_master = False | 466 | _ssh_master = False |
467 | print('\nwarn: cannot enable ssh control master for %s:%s\n%s' | 467 | print('\nwarn: cannot enable ssh control master for %s:%s\n%s' |
468 | % (host, port, str(e)), file=sys.stderr) | 468 | % (host, port, str(e)), file=sys.stderr) |
469 | return False | 469 | return False |
470 | 470 | ||
471 | time.sleep(1) | 471 | time.sleep(1) |
@@ -583,7 +583,7 @@ class Remote(object): | |||
583 | self.review = self._Get('review') | 583 | self.review = self._Get('review') |
584 | self.projectname = self._Get('projectname') | 584 | self.projectname = self._Get('projectname') |
585 | self.fetch = list(map(RefSpec.FromString, | 585 | self.fetch = list(map(RefSpec.FromString, |
586 | self._Get('fetch', all_keys=True))) | 586 | self._Get('fetch', all_keys=True))) |
587 | self._review_url = None | 587 | self._review_url = None |
588 | 588 | ||
589 | def _InsteadOf(self): | 589 | def _InsteadOf(self): |
@@ -598,7 +598,7 @@ class Remote(object): | |||
598 | 598 | ||
599 | for insteadOf in insteadOfList: | 599 | for insteadOf in insteadOfList: |
600 | if self.url.startswith(insteadOf) \ | 600 | if self.url.startswith(insteadOf) \ |
601 | and len(insteadOf) > len(longest): | 601 | and len(insteadOf) > len(longest): |
602 | longest = insteadOf | 602 | longest = insteadOf |
603 | longestUrl = url | 603 | longestUrl = url |
604 | 604 | ||
diff --git a/gitc_utils.py b/gitc_utils.py index a2b04d98..45920b07 100644 --- a/gitc_utils.py +++ b/gitc_utils.py | |||
@@ -52,7 +52,7 @@ def _set_project_revisions(projects): | |||
52 | project.remote.url, | 52 | project.remote.url, |
53 | project.revisionExpr], | 53 | project.revisionExpr], |
54 | capture_stdout=True, cwd='/tmp')) | 54 | capture_stdout=True, cwd='/tmp')) |
55 | for project in projects if not git_config.IsId(project.revisionExpr)] | 55 | for project in projects if not git_config.IsId(project.revisionExpr)] |
56 | for proj, gitcmd in project_gitcmds: | 56 | for proj, gitcmd in project_gitcmds: |
57 | if gitcmd.Wait(): | 57 | if gitcmd.Wait(): |
58 | print('FATAL: Failed to retrieve revisionExpr for %s' % proj) | 58 | print('FATAL: Failed to retrieve revisionExpr for %s' % proj) |
@@ -188,7 +188,7 @@ class _Repo(object): | |||
188 | copts = cmd.ReadEnvironmentOptions(copts) | 188 | copts = cmd.ReadEnvironmentOptions(copts) |
189 | except NoManifestException as e: | 189 | except NoManifestException as e: |
190 | print('error: in `%s`: %s' % (' '.join([name] + argv), str(e)), | 190 | print('error: in `%s`: %s' % (' '.join([name] + argv), str(e)), |
191 | file=sys.stderr) | 191 | file=sys.stderr) |
192 | print('error: manifest missing or unreadable -- please run init', | 192 | print('error: manifest missing or unreadable -- please run init', |
193 | file=sys.stderr) | 193 | file=sys.stderr) |
194 | return 1 | 194 | return 1 |
@@ -211,9 +211,9 @@ class _Repo(object): | |||
211 | cmd.ValidateOptions(copts, cargs) | 211 | cmd.ValidateOptions(copts, cargs) |
212 | result = cmd.Execute(copts, cargs) | 212 | result = cmd.Execute(copts, cargs) |
213 | except (DownloadError, ManifestInvalidRevisionError, | 213 | except (DownloadError, ManifestInvalidRevisionError, |
214 | NoManifestException) as e: | 214 | NoManifestException) as e: |
215 | print('error: in `%s`: %s' % (' '.join([name] + argv), str(e)), | 215 | print('error: in `%s`: %s' % (' '.join([name] + argv), str(e)), |
216 | file=sys.stderr) | 216 | file=sys.stderr) |
217 | if isinstance(e, NoManifestException): | 217 | if isinstance(e, NoManifestException): |
218 | print('error: manifest missing or unreadable -- please run init', | 218 | print('error: manifest missing or unreadable -- please run init', |
219 | file=sys.stderr) | 219 | file=sys.stderr) |
@@ -346,7 +346,7 @@ class _BasicAuthHandler(urllib.request.HTTPBasicAuthHandler): | |||
346 | def http_error_401(self, req, fp, code, msg, headers): | 346 | def http_error_401(self, req, fp, code, msg, headers): |
347 | _AddPasswordFromUserInput(self, msg, req) | 347 | _AddPasswordFromUserInput(self, msg, req) |
348 | return urllib.request.HTTPBasicAuthHandler.http_error_401( | 348 | return urllib.request.HTTPBasicAuthHandler.http_error_401( |
349 | self, req, fp, code, msg, headers) | 349 | self, req, fp, code, msg, headers) |
350 | 350 | ||
351 | def http_error_auth_reqed(self, authreq, host, req, headers): | 351 | def http_error_auth_reqed(self, authreq, host, req, headers): |
352 | try: | 352 | try: |
@@ -356,7 +356,7 @@ class _BasicAuthHandler(urllib.request.HTTPBasicAuthHandler): | |||
356 | old_add_header(name, val) | 356 | old_add_header(name, val) |
357 | req.add_header = _add_header | 357 | req.add_header = _add_header |
358 | return urllib.request.AbstractBasicAuthHandler.http_error_auth_reqed( | 358 | return urllib.request.AbstractBasicAuthHandler.http_error_auth_reqed( |
359 | self, authreq, host, req, headers) | 359 | self, authreq, host, req, headers) |
360 | except: | 360 | except: |
361 | reset = getattr(self, 'reset_retry_count', None) | 361 | reset = getattr(self, 'reset_retry_count', None) |
362 | if reset is not None: | 362 | if reset is not None: |
@@ -369,7 +369,7 @@ class _DigestAuthHandler(urllib.request.HTTPDigestAuthHandler): | |||
369 | def http_error_401(self, req, fp, code, msg, headers): | 369 | def http_error_401(self, req, fp, code, msg, headers): |
370 | _AddPasswordFromUserInput(self, msg, req) | 370 | _AddPasswordFromUserInput(self, msg, req) |
371 | return urllib.request.HTTPDigestAuthHandler.http_error_401( | 371 | return urllib.request.HTTPDigestAuthHandler.http_error_401( |
372 | self, req, fp, code, msg, headers) | 372 | self, req, fp, code, msg, headers) |
373 | 373 | ||
374 | def http_error_auth_reqed(self, auth_header, host, req, headers): | 374 | def http_error_auth_reqed(self, auth_header, host, req, headers): |
375 | try: | 375 | try: |
@@ -379,7 +379,7 @@ class _DigestAuthHandler(urllib.request.HTTPDigestAuthHandler): | |||
379 | old_add_header(name, val) | 379 | old_add_header(name, val) |
380 | req.add_header = _add_header | 380 | req.add_header = _add_header |
381 | return urllib.request.AbstractDigestAuthHandler.http_error_auth_reqed( | 381 | return urllib.request.AbstractDigestAuthHandler.http_error_auth_reqed( |
382 | self, auth_header, host, req, headers) | 382 | self, auth_header, host, req, headers) |
383 | except: | 383 | except: |
384 | reset = getattr(self, 'reset_retry_count', None) | 384 | reset = getattr(self, 'reset_retry_count', None) |
385 | if reset is not None: | 385 | if reset is not None: |
@@ -406,7 +406,7 @@ class _KerberosAuthHandler(urllib.request.BaseHandler): | |||
406 | 406 | ||
407 | if self.retried > 3: | 407 | if self.retried > 3: |
408 | raise urllib.request.HTTPError(req.get_full_url(), 401, | 408 | raise urllib.request.HTTPError(req.get_full_url(), 401, |
409 | "Negotiate auth failed", headers, None) | 409 | "Negotiate auth failed", headers, None) |
410 | else: | 410 | else: |
411 | self.retried += 1 | 411 | self.retried += 1 |
412 | 412 | ||
diff --git a/manifest_xml.py b/manifest_xml.py index 9df03c06..fd0e4f12 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -140,12 +140,12 @@ class XmlManifest(object): | |||
140 | self._load_local_manifests = True | 140 | self._load_local_manifests = True |
141 | 141 | ||
142 | self.repoProject = MetaProject(self, 'repo', | 142 | self.repoProject = MetaProject(self, 'repo', |
143 | gitdir=os.path.join(repodir, 'repo/.git'), | 143 | gitdir=os.path.join(repodir, 'repo/.git'), |
144 | worktree=os.path.join(repodir, 'repo')) | 144 | worktree=os.path.join(repodir, 'repo')) |
145 | 145 | ||
146 | self.manifestProject = MetaProject(self, 'manifests', | 146 | self.manifestProject = MetaProject(self, 'manifests', |
147 | gitdir=os.path.join(repodir, 'manifests.git'), | 147 | gitdir=os.path.join(repodir, 'manifests.git'), |
148 | worktree=os.path.join(repodir, 'manifests')) | 148 | worktree=os.path.join(repodir, 'manifests')) |
149 | 149 | ||
150 | self._Unload() | 150 | self._Unload() |
151 | 151 | ||
@@ -462,12 +462,12 @@ class XmlManifest(object): | |||
462 | self.localManifestWarning = True | 462 | self.localManifestWarning = True |
463 | print('warning: %s is deprecated; put local manifests ' | 463 | print('warning: %s is deprecated; put local manifests ' |
464 | 'in `%s` instead' % (LOCAL_MANIFEST_NAME, | 464 | 'in `%s` instead' % (LOCAL_MANIFEST_NAME, |
465 | os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)), | 465 | os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)), |
466 | file=sys.stderr) | 466 | file=sys.stderr) |
467 | nodes.append(self._ParseManifestXml(local, self.repodir)) | 467 | nodes.append(self._ParseManifestXml(local, self.repodir)) |
468 | 468 | ||
469 | local_dir = os.path.abspath(os.path.join(self.repodir, | 469 | local_dir = os.path.abspath(os.path.join(self.repodir, |
470 | LOCAL_MANIFESTS_DIR_NAME)) | 470 | LOCAL_MANIFESTS_DIR_NAME)) |
471 | try: | 471 | try: |
472 | for local_file in sorted(platform_utils.listdir(local_dir)): | 472 | for local_file in sorted(platform_utils.listdir(local_dir)): |
473 | if local_file.endswith('.xml'): | 473 | if local_file.endswith('.xml'): |
@@ -512,7 +512,7 @@ class XmlManifest(object): | |||
512 | fp = os.path.join(include_root, name) | 512 | fp = os.path.join(include_root, name) |
513 | if not os.path.isfile(fp): | 513 | if not os.path.isfile(fp): |
514 | raise ManifestParseError("include %s doesn't exist or isn't a file" | 514 | raise ManifestParseError("include %s doesn't exist or isn't a file" |
515 | % (name,)) | 515 | % (name,)) |
516 | try: | 516 | try: |
517 | nodes.extend(self._ParseManifestXml(fp, include_root)) | 517 | nodes.extend(self._ParseManifestXml(fp, include_root)) |
518 | # should isolate this to the exact exception, but that's | 518 | # should isolate this to the exact exception, but that's |
@@ -811,21 +811,21 @@ class XmlManifest(object): | |||
811 | remote = self._default.remote | 811 | remote = self._default.remote |
812 | if remote is None: | 812 | if remote is None: |
813 | raise ManifestParseError("no remote for project %s within %s" % | 813 | raise ManifestParseError("no remote for project %s within %s" % |
814 | (name, self.manifestFile)) | 814 | (name, self.manifestFile)) |
815 | 815 | ||
816 | revisionExpr = node.getAttribute('revision') or remote.revision | 816 | revisionExpr = node.getAttribute('revision') or remote.revision |
817 | if not revisionExpr: | 817 | if not revisionExpr: |
818 | revisionExpr = self._default.revisionExpr | 818 | revisionExpr = self._default.revisionExpr |
819 | if not revisionExpr: | 819 | if not revisionExpr: |
820 | raise ManifestParseError("no revision for project %s within %s" % | 820 | raise ManifestParseError("no revision for project %s within %s" % |
821 | (name, self.manifestFile)) | 821 | (name, self.manifestFile)) |
822 | 822 | ||
823 | path = node.getAttribute('path') | 823 | path = node.getAttribute('path') |
824 | if not path: | 824 | if not path: |
825 | path = name | 825 | path = name |
826 | if path.startswith('/'): | 826 | if path.startswith('/'): |
827 | raise ManifestParseError("project %s path cannot be absolute in %s" % | 827 | raise ManifestParseError("project %s path cannot be absolute in %s" % |
828 | (name, self.manifestFile)) | 828 | (name, self.manifestFile)) |
829 | 829 | ||
830 | rebase = node.getAttribute('rebase') | 830 | rebase = node.getAttribute('rebase') |
831 | if not rebase: | 831 | if not rebase: |
@@ -1054,7 +1054,7 @@ class XmlManifest(object): | |||
1054 | keep = "true" | 1054 | keep = "true" |
1055 | if keep != "true" and keep != "false": | 1055 | if keep != "true" and keep != "false": |
1056 | raise ManifestParseError('optional "keep" attribute must be ' | 1056 | raise ManifestParseError('optional "keep" attribute must be ' |
1057 | '"true" or "false"') | 1057 | '"true" or "false"') |
1058 | project.AddAnnotation(name, value, keep) | 1058 | project.AddAnnotation(name, value, keep) |
1059 | 1059 | ||
1060 | def _get_remote(self, node): | 1060 | def _get_remote(self, node): |
@@ -1065,7 +1065,7 @@ class XmlManifest(object): | |||
1065 | v = self._remotes.get(name) | 1065 | v = self._remotes.get(name) |
1066 | if not v: | 1066 | if not v: |
1067 | raise ManifestParseError("remote %s not defined in %s" % | 1067 | raise ManifestParseError("remote %s not defined in %s" % |
1068 | (name, self.manifestFile)) | 1068 | (name, self.manifestFile)) |
1069 | return v | 1069 | return v |
1070 | 1070 | ||
1071 | def _reqatt(self, node, attname): | 1071 | def _reqatt(self, node, attname): |
@@ -1075,7 +1075,7 @@ class XmlManifest(object): | |||
1075 | v = node.getAttribute(attname) | 1075 | v = node.getAttribute(attname) |
1076 | if not v: | 1076 | if not v: |
1077 | raise ManifestParseError("no %s in <%s> within %s" % | 1077 | raise ManifestParseError("no %s in <%s> within %s" % |
1078 | (attname, node.nodeName, self.manifestFile)) | 1078 | (attname, node.nodeName, self.manifestFile)) |
1079 | return v | 1079 | return v |
1080 | 1080 | ||
1081 | def projectsDiff(self, manifest): | 1081 | def projectsDiff(self, manifest): |
diff --git a/progress.py b/progress.py index d2ed4bae..8a643db2 100644 --- a/progress.py +++ b/progress.py | |||
@@ -53,9 +53,9 @@ class Progress(object): | |||
53 | 53 | ||
54 | if self._total <= 0: | 54 | if self._total <= 0: |
55 | sys.stderr.write('%s\r%s: %d,' % ( | 55 | sys.stderr.write('%s\r%s: %d,' % ( |
56 | CSI_ERASE_LINE, | 56 | CSI_ERASE_LINE, |
57 | self._title, | 57 | self._title, |
58 | self._done)) | 58 | self._done)) |
59 | sys.stderr.flush() | 59 | sys.stderr.flush() |
60 | else: | 60 | else: |
61 | p = (100 * self._done) / self._total | 61 | p = (100 * self._done) / self._total |
@@ -63,13 +63,13 @@ class Progress(object): | |||
63 | if self._lastp != p or self._always_print_percentage: | 63 | if self._lastp != p or self._always_print_percentage: |
64 | self._lastp = p | 64 | self._lastp = p |
65 | sys.stderr.write('%s\r%s: %3d%% (%d%s/%d%s)%s%s%s' % ( | 65 | sys.stderr.write('%s\r%s: %3d%% (%d%s/%d%s)%s%s%s' % ( |
66 | CSI_ERASE_LINE, | 66 | CSI_ERASE_LINE, |
67 | self._title, | 67 | self._title, |
68 | p, | 68 | p, |
69 | self._done, self._units, | 69 | self._done, self._units, |
70 | self._total, self._units, | 70 | self._total, self._units, |
71 | ' ' if msg else '', msg, | 71 | ' ' if msg else '', msg, |
72 | "\n" if self._print_newline else "")) | 72 | "\n" if self._print_newline else "")) |
73 | sys.stderr.flush() | 73 | sys.stderr.flush() |
74 | 74 | ||
75 | def end(self): | 75 | def end(self): |
@@ -78,16 +78,16 @@ class Progress(object): | |||
78 | 78 | ||
79 | if self._total <= 0: | 79 | if self._total <= 0: |
80 | sys.stderr.write('%s\r%s: %d, done.\n' % ( | 80 | sys.stderr.write('%s\r%s: %d, done.\n' % ( |
81 | CSI_ERASE_LINE, | 81 | CSI_ERASE_LINE, |
82 | self._title, | 82 | self._title, |
83 | self._done)) | 83 | self._done)) |
84 | sys.stderr.flush() | 84 | sys.stderr.flush() |
85 | else: | 85 | else: |
86 | p = (100 * self._done) / self._total | 86 | p = (100 * self._done) / self._total |
87 | sys.stderr.write('%s\r%s: %3d%% (%d%s/%d%s), done.\n' % ( | 87 | sys.stderr.write('%s\r%s: %3d%% (%d%s/%d%s), done.\n' % ( |
88 | CSI_ERASE_LINE, | 88 | CSI_ERASE_LINE, |
89 | self._title, | 89 | self._title, |
90 | p, | 90 | p, |
91 | self._done, self._units, | 91 | self._done, self._units, |
92 | self._total, self._units)) | 92 | self._total, self._units)) |
93 | sys.stderr.flush() | 93 | sys.stderr.flush() |
@@ -2341,7 +2341,7 @@ class Project(object): | |||
2341 | else: | 2341 | else: |
2342 | branch = self.revisionExpr | 2342 | branch = self.revisionExpr |
2343 | if (not self.manifest.IsMirror and is_sha1 and depth | 2343 | if (not self.manifest.IsMirror and is_sha1 and depth |
2344 | and git_require((1, 8, 3))): | 2344 | and git_require((1, 8, 3))): |
2345 | # Shallow checkout of a specific commit, fetch from that commit and not | 2345 | # Shallow checkout of a specific commit, fetch from that commit and not |
2346 | # the heads only as the commit might be deeper in the history. | 2346 | # the heads only as the commit might be deeper in the history. |
2347 | spec.append(branch) | 2347 | spec.append(branch) |
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) |