Valentin David pushed to branch valentindavid/git_shallow_fetch at BuildStream / buildstream
Commits:
-
aa1b3918
by Valentin David at 2018-12-05T13:40:46Z
1 changed file:
Changes:
| ... | ... | @@ -146,6 +146,7 @@ import shutil |
| 146 | 146 |
from collections.abc import Mapping
|
| 147 | 147 |
from io import StringIO
|
| 148 | 148 |
from tempfile import TemporaryFile
|
| 149 |
+import subprocess
|
|
| 149 | 150 |
|
| 150 | 151 |
from configparser import RawConfigParser
|
| 151 | 152 |
|
| ... | ... | @@ -227,10 +228,16 @@ class GitMirror(SourceFetcher): |
| 227 | 228 |
self.ensure_trackable(alias_override=alias_override)
|
| 228 | 229 |
return
|
| 229 | 230 |
|
| 230 |
- self.source.call([self.source.host_git, 'fetch', '--depth=1', 'origin', self.ref],
|
|
| 231 |
- cwd=tmpdir,
|
|
| 232 |
- fail="Failed to fetch repository",
|
|
| 233 |
- fail_temporarily=True)
|
|
| 231 |
+ exit_code, output = self.source.check_output([self.source.host_git, 'fetch', '--depth=1', 'origin', self.ref],
|
|
| 232 |
+ stderr=subprocess.PIPE,
|
|
| 233 |
+ cwd=tmpdir)
|
|
| 234 |
+ if exit_code != 0:
|
|
| 235 |
+ import sys
|
|
| 236 |
+ sys.stderr.write("git error:\n")
|
|
| 237 |
+ sys.stderr.write(output)
|
|
| 238 |
+ sys.stderr.write("====")
|
|
| 239 |
+ raise PluginError("{plugin}: {message}".format(plugin=self, message="git fetch failed"),
|
|
| 240 |
+ temporary=True)
|
|
| 234 | 241 |
|
| 235 | 242 |
# We need to have a ref to make it clonable
|
| 236 | 243 |
self.source.call([self.source.host_git, 'update-ref', 'HEAD', self.ref],
|
