From 83645971b8e134f45bded528e0e0786819203252 Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Wed, 12 Oct 2016 21:13:20 +0200 Subject: test, #525: allow disabling freeze errors separately + cmd: use DEVNULL for non PIPEs; no open-file. + TCs: some unitestize-assertions on base & remote TCs. --- git/util.py | 1 + 1 file changed, 1 insertion(+) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 57e056c3..568d9328 100644 --- a/git/util.py +++ b/git/util.py @@ -51,6 +51,7 @@ __all__ = ("stream_copy", "join_path", "to_native_path_windows", "to_native_path #: so the errors marked with this var are considered "acknowledged" ones, awaiting remedy, #: till then, we wish to hide them. HIDE_WINDOWS_KNOWN_ERRORS = is_win and os.environ.get('HIDE_WINDOWS_KNOWN_ERRORS', True) +HIDE_WINDOWS_FREEZE_ERRORS = is_win and os.environ.get('HIDE_WINDOWS_FREEZE_ERRORS', HIDE_WINDOWS_KNOWN_ERRORS) #{ Utility Methods -- cgit v1.2.1 From 85f38a1bbc8fc4b19ebf2a52a3640b59a5dcf9fe Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Wed, 12 Oct 2016 23:09:54 +0200 Subject: remote, #525: pump fetch-infos instead of GIL-read stderr + `handle_process_output()` accepts null-finalizer, to pump completely stderr before raising any errors. + test: Enable `TestGit.test_environment()` on Windows (to checks stderr consumption). --- git/util.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 568d9328..7f18eed9 100644 --- a/git/util.py +++ b/git/util.py @@ -199,33 +199,34 @@ class RemoteProgress(object): DONE_TOKEN = 'done.' TOKEN_SEPARATOR = ', ' - __slots__ = ("_cur_line", "_seen_ops", "_error_lines") + __slots__ = ('_cur_line', + '_seen_ops', + 'error_lines', # Lines that started with 'error:' or 'fatal:'. + 'other_lines') # Lines not denoting progress (i.e.g. push-infos). 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 error_lines(self): - """Returns all lines that started with error: or fatal:""" - return self._error_lines + self.error_lines = [] + self.other_lines = [] def _parse_progress_line(self, line): """Parse progress information from the given line as retrieved by git-push or git-fetch. - Lines that seem to contain an error (i.e. start with error: or fatal:) are stored - separately and can be queried using `error_lines()`. + - Lines that do not contain progress info are stored in :attr:`other_lines`. + - Lines that seem to contain an error (i.e. start with error: or fatal:) are stored + in :attr:`error_lines`. :return: list(line, ...) list of lines that could not be processed""" # handle # 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') @@ -284,6 +285,7 @@ class RemoteProgress(object): self.line_dropped(sline) # Note: Don't add this line to the failed lines, as we have to silently # drop it + self.other_lines.extend(failed_lines) return failed_lines # END handle op code @@ -309,6 +311,7 @@ class RemoteProgress(object): max_count and float(max_count), message) # END for each sub line + self.other_lines.extend(failed_lines) return failed_lines def new_message_handler(self): -- cgit v1.2.1 From 5e6827e98c2732863857c0887d5de4138a8ae48b Mon Sep 17 00:00:00 2001 From: Kostis Anagnostopoulos Date: Thu, 13 Oct 2016 00:42:04 +0200 Subject: remote, #525: FIX BUG push-cmd misses error messages + Bug discovered after enabling TC in prev commit and rework of fetch. + remote_tc: unitestize assertions. + util: DEL unused `_mktemp()`. --- git/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git/util.py') diff --git a/git/util.py b/git/util.py index 7f18eed9..d00de1e4 100644 --- a/git/util.py +++ b/git/util.py @@ -17,7 +17,7 @@ import time from functools import wraps from git.compat import is_win -from gitdb.util import (# NOQA +from gitdb.util import (# NOQA @IgnorePep8 make_sha, LockedFD, # @UnusedImport file_contents_ro, # @UnusedImport -- cgit v1.2.1