Commit 43f4ecc6 authored by iannucci@chromium.org's avatar iannucci@chromium.org

Make git rebase-update more responsive.

Passes through git-fetch's output instead of buffering it.

R=djacques@chromium.org
TBR=agable@chromium.org
BUG=366375

Review URL: https://codereview.chromium.org/264423002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@269080 0039d316-1c4b-4281-b951-d872f2087c98
parent 5c7e5b31
...@@ -64,10 +64,8 @@ def fetch_remotes(branch_tree): ...@@ -64,10 +64,8 @@ def fetch_remotes(branch_tree):
if not fetch_args: # pragma: no cover if not fetch_args: # pragma: no cover
print 'Nothing to fetch.' print 'Nothing to fetch.'
else: else:
out, err = git.run_with_stderr('fetch', *fetch_args) git.run_with_stderr('fetch', *fetch_args, stdout=sys.stdout,
for data, stream in zip((out, err), (sys.stdout, sys.stderr)): stderr=sys.stderr)
if data:
print >> stream, data
def remove_empty_branches(branch_tree): def remove_empty_branches(branch_tree):
......
...@@ -14,8 +14,6 @@ import sys ...@@ -14,8 +14,6 @@ import sys
import tempfile import tempfile
import unittest import unittest
from cStringIO import StringIO
def git_hash_data(data, typ='blob'): def git_hash_data(data, typ='blob'):
"""Calculate the git-style SHA1 for some data. """Calculate the git-style SHA1 for some data.
...@@ -395,13 +393,17 @@ class GitRepo(object): ...@@ -395,13 +393,17 @@ class GitRepo(object):
stdout = sys.stdout stdout = sys.stdout
stderr = sys.stderr stderr = sys.stderr
try: try:
sys.stdout = StringIO() # "multiple statements on a line" pylint: disable=C0321
sys.stderr = StringIO() with tempfile.TemporaryFile() as out, tempfile.TemporaryFile() as err:
try: sys.stdout = out
self.run(fn, *args, **kwargs) sys.stderr = err
except SystemExit: try:
pass self.run(fn, *args, **kwargs)
return sys.stdout.getvalue(), sys.stderr.getvalue() except SystemExit:
pass
out.seek(0)
err.seek(0)
return out.read(), err.read()
finally: finally:
sys.stdout = stdout sys.stdout = stdout
sys.stderr = stderr sys.stderr = stderr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment