From 78f3f38d18fc88fd639af8a6c1ef757d2ffe51d6 Mon Sep 17 00:00:00 2001 From: Barry Scott Date: Sun, 29 May 2016 13:59:53 +0100 Subject: Return stderr lines from a pull() call that fails --- git/util.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 5ed014fc..f185156c 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: -- cgit v1.2.1 From 46201b346fec29f9cb740728a3c20266094d58b2 Mon Sep 17 00:00:00 2001 From: Barry Scott Date: Mon, 30 May 2016 15:05:32 +0100 Subject: Fix flake8 complaints --- git/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index f185156c..2f894576 100644 --- a/git/util.py +++ b/git/util.py @@ -194,8 +194,8 @@ 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 ) + 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') -- cgit v1.2.1 From 08a0fad2c9dcdfe0bbc980b8cd260b4be5582381 Mon Sep 17 00:00:00 2001 From: Barry Scott Date: Mon, 30 May 2016 15:49:40 +0100 Subject: Make sure that stderr is converted to bytes remove stderr for a wait() that is not the GitPython wrapper. --- git/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 2f894576..706518b8 100644 --- a/git/util.py +++ b/git/util.py @@ -772,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() -- cgit v1.2.1