From 81f5c596712c2e8c32cd9debb46a96b66d463ad4 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 4 Jul 2019 18:13:31 -0400 Subject: [PATCH] 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 --- project.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/project.py b/project.py index 8a38c58..e0419e7 100755 --- a/project.py +++ b/project.py @@ -2815,15 +2815,10 @@ class Project(object): gitdir=self._gitdir, capture_stdout=True, capture_stderr=True) - r = [] - for line in p.process.stdout: - if line[-1] == '\n': - line = line[:-1] - r.append(line) if p.Wait() != 0: raise GitError('%s rev-list %s: %s' % (self._project.name, str(args), p.stderr)) - return r + return p.stdout.splitlines() def __getattr__(self, name): """Allow arbitrary git commands using pythonic syntax.