diff options
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 21 |
1 files changed, 15 insertions, 6 deletions
| @@ -1039,6 +1039,7 @@ class Project(object): | |||
| 1039 | def Sync_NetworkHalf(self, | 1039 | def Sync_NetworkHalf(self, |
| 1040 | quiet=False, | 1040 | quiet=False, |
| 1041 | verbose=False, | 1041 | verbose=False, |
| 1042 | output_redir=None, | ||
| 1042 | is_new=None, | 1043 | is_new=None, |
| 1043 | current_branch_only=False, | 1044 | current_branch_only=False, |
| 1044 | force_sync=False, | 1045 | force_sync=False, |
| @@ -1126,8 +1127,9 @@ class Project(object): | |||
| 1126 | (ID_RE.match(self.revisionExpr) and | 1127 | (ID_RE.match(self.revisionExpr) and |
| 1127 | self._CheckForImmutableRevision())): | 1128 | self._CheckForImmutableRevision())): |
| 1128 | if not self._RemoteFetch( | 1129 | if not self._RemoteFetch( |
| 1129 | initial=is_new, quiet=quiet, verbose=verbose, alt_dir=alt_dir, | 1130 | initial=is_new, |
| 1130 | current_branch_only=current_branch_only, | 1131 | quiet=quiet, verbose=verbose, output_redir=output_redir, |
| 1132 | alt_dir=alt_dir, current_branch_only=current_branch_only, | ||
| 1131 | tags=tags, prune=prune, depth=depth, | 1133 | tags=tags, prune=prune, depth=depth, |
| 1132 | submodules=submodules, force_sync=force_sync, | 1134 | submodules=submodules, force_sync=force_sync, |
| 1133 | clone_filter=clone_filter, retry_fetches=retry_fetches): | 1135 | clone_filter=clone_filter, retry_fetches=retry_fetches): |
| @@ -1139,7 +1141,11 @@ class Project(object): | |||
| 1139 | alternates_file = os.path.join(self.gitdir, 'objects/info/alternates') | 1141 | alternates_file = os.path.join(self.gitdir, 'objects/info/alternates') |
| 1140 | if os.path.exists(alternates_file): | 1142 | if os.path.exists(alternates_file): |
| 1141 | cmd = ['repack', '-a', '-d'] | 1143 | cmd = ['repack', '-a', '-d'] |
| 1142 | if GitCommand(self, cmd, bare=True).Wait() != 0: | 1144 | p = GitCommand(self, cmd, bare=True, capture_stdout=bool(output_redir), |
| 1145 | merge_output=bool(output_redir)) | ||
| 1146 | if p.stdout and output_redir: | ||
| 1147 | buf.write(p.stdout) | ||
| 1148 | if p.Wait() != 0: | ||
| 1143 | return False | 1149 | return False |
| 1144 | platform_utils.remove(alternates_file) | 1150 | platform_utils.remove(alternates_file) |
| 1145 | 1151 | ||
| @@ -1951,6 +1957,7 @@ class Project(object): | |||
| 1951 | initial=False, | 1957 | initial=False, |
| 1952 | quiet=False, | 1958 | quiet=False, |
| 1953 | verbose=False, | 1959 | verbose=False, |
| 1960 | output_redir=None, | ||
| 1954 | alt_dir=None, | 1961 | alt_dir=None, |
| 1955 | tags=True, | 1962 | tags=True, |
| 1956 | prune=False, | 1963 | prune=False, |
| @@ -2128,7 +2135,9 @@ class Project(object): | |||
| 2128 | ok = prune_tried = False | 2135 | ok = prune_tried = False |
| 2129 | for try_n in range(retry_fetches): | 2136 | for try_n in range(retry_fetches): |
| 2130 | gitcmd = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy, | 2137 | gitcmd = GitCommand(self, cmd, bare=True, ssh_proxy=ssh_proxy, |
| 2131 | merge_output=True, capture_stdout=quiet) | 2138 | merge_output=True, capture_stdout=quiet or bool(output_redir)) |
| 2139 | if gitcmd.stdout and not quiet and output_redir: | ||
| 2140 | output_redir.write(gitcmd.stdout) | ||
| 2132 | ret = gitcmd.Wait() | 2141 | ret = gitcmd.Wait() |
| 2133 | if ret == 0: | 2142 | if ret == 0: |
| 2134 | ok = True | 2143 | ok = True |
| @@ -2170,7 +2179,7 @@ class Project(object): | |||
| 2170 | # Git died with a signal, exit immediately | 2179 | # Git died with a signal, exit immediately |
| 2171 | break | 2180 | break |
| 2172 | if not verbose: | 2181 | if not verbose: |
| 2173 | print('%s:\n%s' % (self.name, gitcmd.stdout), file=sys.stderr) | 2182 | print('\n%s:\n%s' % (self.name, gitcmd.stdout), file=sys.stderr) |
| 2174 | time.sleep(random.randint(30, 45)) | 2183 | time.sleep(random.randint(30, 45)) |
| 2175 | 2184 | ||
| 2176 | if initial: | 2185 | if initial: |
| @@ -2189,7 +2198,7 @@ class Project(object): | |||
| 2189 | # Sync the current branch only with depth set to None. | 2198 | # Sync the current branch only with depth set to None. |
| 2190 | # We always pass depth=None down to avoid infinite recursion. | 2199 | # We always pass depth=None down to avoid infinite recursion. |
| 2191 | return self._RemoteFetch( | 2200 | return self._RemoteFetch( |
| 2192 | name=name, quiet=quiet, verbose=verbose, | 2201 | name=name, quiet=quiet, verbose=verbose, output_redir=output_redir, |
| 2193 | current_branch_only=current_branch_only and depth, | 2202 | current_branch_only=current_branch_only and depth, |
| 2194 | initial=False, alt_dir=alt_dir, | 2203 | initial=False, alt_dir=alt_dir, |
| 2195 | depth=None, clone_filter=clone_filter) | 2204 | depth=None, clone_filter=clone_filter) |
