Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e6827e

Browse files
committed
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()`.
1 parent85f38a1 commit5e6827e

File tree

5 files changed

+91
-83
lines changed

5 files changed

+91
-83
lines changed

‎git/cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def __del__(self):
247247
def __getattr__(self, attr):
248248
return getattr(self.proc, attr)
249249

250-
def wait(self, stderr=b''):
250+
def wait(self, stderr=b''): # TODO: Bad choice to mimic `proc.wait()` but with different args.
251251
"""Wait for the process and return its status code.
252252

253253
:param stderr: Previously read value of stderr, in case stderr is already closed.

‎git/remote.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
)
2828
from git.util import (
2929
join_path,
30-
finalize_process
3130
)
3231
from git.cmd import handle_process_output, Git
3332
from gitdb.util import join
@@ -681,16 +680,19 @@ def stdout_handler(line):
681680
try:
682681
output.append(PushInfo._from_line(self, line))
683682
except ValueError:
684-
#if an error happens, additional info is given which wecannotparse
683+
#If an error happens, additional info is given which we parse below.
685684
pass
686-
# END exception handling
687-
# END for each line
688685

686+
handle_process_output(proc, stdout_handler, progress_handler, finalizer=None, decode_streams=False)
687+
stderr_text = progress.error_lines and '\n'.join(progress.error_lines) or ''
689688
try:
690-
handle_process_output(proc, stdout_handler, progress_handler, finalize_process, decode_streams=False)
689+
proc.wait(stderr=stderr_text)
691690
except Exception:
692-
iflen(output) == 0:
691+
ifnot output:
693692
raise
693+
elif stderr_text:
694+
log.warning("Error lines received while fetching: %s", stderr_text)
695+
694696
return output
695697

696698
def _assert_refspec(self):

‎git/test/lib/helper.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
import textwrap
1414
import time
1515
from unittest import TestCase
16+
import unittest
1617

17-
from git.compat import string_types, is_win
18+
from git.compat import string_types, is_win, PY3
1819
from git.util import rmtree
1920

2021
import os.path as osp
@@ -68,18 +69,6 @@ def wait(self):
6869
#{ Decorators
6970

7071

71-
def _mktemp(*args):
72-
"""Wrapper around default tempfile.mktemp to fix an osx issue
73-
:note: the OSX special case was removed as it was unclear why that was needed in the first place. It seems
74-
to be just fine without it. However, if we leave this special case, and if TMPDIR is set to something custom,
75-
prefixing /private/ will lead to incorrect paths on OSX."""
76-
tdir = tempfile.mktemp(*args)
77-
# See :note: above to learn why this is comented out.
78-
# if is_darwin:
79-
# tdir = '/private' + tdir
80-
return tdir
81-
82-
8372
def with_rw_directory(func):
8473
"""Create a temporary directory which can be written to, remove it if the
8574
test succeeds, but leave it otherwise to aid additional debugging"""
@@ -129,7 +118,7 @@ def repo_creator(self):
129118
if bare:
130119
prefix = ''
131120
# END handle prefix
132-
repo_dir =_mktemp("%sbare_%s" % (prefix, func.__name__))
121+
repo_dir =tempfile.mktemp("%sbare_%s" % (prefix, func.__name__))
133122
rw_repo = self.rorepo.clone(repo_dir, shared=True, bare=bare, n=True)
134123

135124
rw_repo.head.commit = rw_repo.commit(working_tree_ref)
@@ -222,8 +211,8 @@ def argument_passer(func):
222211

223212
@wraps(func)
224213
def remote_repo_creator(self):
225-
remote_repo_dir =_mktemp("remote_repo_%s" % func.__name__)
226-
repo_dir =_mktemp("remote_clone_non_bare_repo")
214+
remote_repo_dir =tempfile.mktemp("remote_repo_%s" % func.__name__)
215+
repo_dir =tempfile.mktemp("remote_clone_non_bare_repo")
227216

228217
rw_remote_repo = self.rorepo.clone(remote_repo_dir, shared=True, bare=True)
229218
# recursive alternates info ?
@@ -340,6 +329,9 @@ class TestBase(TestCase):
340329
of the project history ( to assure tests don't fail for others ).
341330
"""
342331

332+
if not PY3:
333+
assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
334+
343335
def _small_repo_url(self):
344336
""":return" a path to a small, clonable repository"""
345337
from git.cmd import Git

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp