Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: testing_support/git_test_utils.py

Issue 264423002: Make git rebase-update more responsive. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Make rebase-update stream fetch output Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_rebase_update.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing_support/git_test_utils.py
diff --git a/testing_support/git_test_utils.py b/testing_support/git_test_utils.py
index d4c0d8035fbcd41a1b3f7696800c3984688417db..10e54f51b5aab7fe1e621b9528f2aa1ce5b40a25 100644
--- a/testing_support/git_test_utils.py
+++ b/testing_support/git_test_utils.py
@@ -14,8 +14,6 @@ import sys
import tempfile
import unittest
-from cStringIO import StringIO
-
def git_hash_data(data, typ='blob'):
"""Calculate the git-style SHA1 for some data.
@@ -395,13 +393,17 @@ class GitRepo(object):
stdout = sys.stdout
stderr = sys.stderr
try:
- sys.stdout = StringIO()
- sys.stderr = StringIO()
- try:
- self.run(fn, *args, **kwargs)
- except SystemExit:
- pass
- return sys.stdout.getvalue(), sys.stderr.getvalue()
+ # "multiple statements on a line" pylint: disable=C0321
+ with tempfile.TemporaryFile() as out, tempfile.TemporaryFile() as err:
+ sys.stdout = out
+ sys.stderr = err
+ try:
+ self.run(fn, *args, **kwargs)
+ except SystemExit:
+ pass
+ out.seek(0)
+ err.seek(0)
+ return out.read(), err.read()
finally:
sys.stdout = stdout
sys.stderr = stderr
« no previous file with comments | « git_rebase_update.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698