summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2019-07-04 18:13:31 -0400
committerMike Frysinger <vapier@google.com>2019-07-05 05:31:38 +0000
commit81f5c596712c2e8c32cd9debb46a96b66d463ad4 (patch)
treed47bbfa6abd13524a6c818b696f10defcac57846
parent1b9adab75a87c5eb94c3c3b653fdc2c123ba0077 (diff)
downloadgit-repo-81f5c596712c2e8c32cd9debb46a96b66d463ad4.tar.gz
project: rev_list: simplify execution
Currently we read the binary stream from the subprocess code directly before waiting for it to finish, but there's no need to do so as we aren't streaming the output to the user. This also means we pass up binary data to the caller as we don't go through GitCommand's internal logic which decodes the stream as utf-8. Simplify the code by calling Wait first, then splitting the entire captured output in one line. Bug: https://crbug.com/gerrit/10418 Change-Id: I7a57904be8cb546a229980fb79c829fc3df31e7d
-rwxr-xr-xproject.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/project.py b/project.py
index 8a38c584..e0419e7a 100755
--- a/project.py
+++ b/project.py
@@ -2815,15 +2815,10 @@ class Project(object):
2815 gitdir=self._gitdir, 2815 gitdir=self._gitdir,
2816 capture_stdout=True, 2816 capture_stdout=True,
2817 capture_stderr=True) 2817 capture_stderr=True)
2818 r = []
2819 for line in p.process.stdout:
2820 if line[-1] == '\n':
2821 line = line[:-1]
2822 r.append(line)
2823 if p.Wait() != 0: 2818 if p.Wait() != 0:
2824 raise GitError('%s rev-list %s: %s' % 2819 raise GitError('%s rev-list %s: %s' %
2825 (self._project.name, str(args), p.stderr)) 2820 (self._project.name, str(args), p.stderr))
2826 return r 2821 return p.stdout.splitlines()
2827 2822
2828 def __getattr__(self, name): 2823 def __getattr__(self, name):
2829 """Allow arbitrary git commands using pythonic syntax. 2824 """Allow arbitrary git commands using pythonic syntax.