diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2016-06-13 09:10:01 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2016-06-13 09:10:01 +0200 |
commit | da86442f6a7bf1263fb5aafdaf904ed2f7db839f (patch) | |
tree | ea368b8973aaceace5f2ef51188005d95be4bc9d /git/util.py | |
parent | ec830a25d39d4eb842ae016095ba257428772294 (diff) | |
parent | 6891caf73735ea465c909de8dc13129cc98c47f7 (diff) | |
download | gitpython-da86442f6a7bf1263fb5aafdaf904ed2f7db839f.tar.gz |
Merge branch 'pr-cmd-raise-with-stderr-on-error' of https://github.com/barry-scott/GitPython into barry-scott-pr-cmd-raise-with-stderr-on-error
Diffstat (limited to 'git/util.py')
-rw-r--r-- | git/util.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/git/util.py b/git/util.py index 5ed014fc..706518b8 100644 --- a/git/util.py +++ b/git/util.py @@ -173,13 +173,17 @@ class RemoteProgress(object): DONE_TOKEN = 'done.' TOKEN_SEPARATOR = ', ' - __slots__ = ("_cur_line", "_seen_ops") + __slots__ = ("_cur_line", "_seen_ops", "_error_lines") re_op_absolute = re.compile(r"(remote: )?([\w\s]+):\s+()(\d+)()(.*)") re_op_relative = re.compile(r"(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)") def __init__(self): self._seen_ops = list() self._cur_line = None + self._error_lines = [] + + def get_stderr(self): + return '\n'.join(self._error_lines) def _parse_progress_line(self, line): """Parse progress information from the given line as retrieved by git-push @@ -190,6 +194,10 @@ class RemoteProgress(object): # Counting objects: 4, done. # Compressing objects: 50% (1/2) \rCompressing objects: 100% (2/2) \rCompressing objects: 100% (2/2), done. self._cur_line = line + if len(self._error_lines) > 0 or self._cur_line.startswith(('error:', 'fatal:')): + self._error_lines.append(self._cur_line) + return [] + sub_lines = line.split('\r') failed_lines = list() for sline in sub_lines: @@ -764,10 +772,10 @@ class WaitGroup(object): self.cv.notify_all() self.cv.release() - def wait(self): + def wait(self, stderr=b''): self.cv.acquire() while self.count > 0: - self.cv.wait() + self.cv.wait(strerr=stderr) self.cv.release() |