From 55406a7ae8ea63e3219e3962653b71c9c11cf7ce Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Tue, 23 Sep 2014 23:40:07 -0400 Subject: [PATCH] let svn fetches print to stdout Summary: As we've done recently for hg and curl, let svn print its fetch progress to stdout, so that the fancy display can show it. Reviewers: sean Differential Revision: https://phabricator.buildinspace.com/D96 --- peru/resources/plugins/svn/reup.py | 2 +- peru/resources/plugins/svn/svn_plugin_shared.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/peru/resources/plugins/svn/reup.py b/peru/resources/plugins/svn/reup.py index 32088a61..6015856e 100755 --- a/peru/resources/plugins/svn/reup.py +++ b/peru/resources/plugins/svn/reup.py @@ -10,7 +10,7 @@ def remote_head_rev(url): - info = svn('info', url).split('\n') + info = svn('info', url, capture_output=True).split('\n') for item in info: if item.startswith('Revision: '): return item.split()[1] diff --git a/peru/resources/plugins/svn/svn_plugin_shared.py b/peru/resources/plugins/svn/svn_plugin_shared.py index c59fe1ac..85051f4d 100644 --- a/peru/resources/plugins/svn/svn_plugin_shared.py +++ b/peru/resources/plugins/svn/svn_plugin_shared.py @@ -4,16 +4,18 @@ import subprocess -def svn(*args, svn_dir=None): +def svn(*args, svn_dir=None, capture_output=False): # Avoid forgetting this arg. assert svn_dir is None or os.path.isdir(svn_dir) command = ['svn', '--non-interactive'] command.extend(args) + stdout = subprocess.PIPE if capture_output else None + stderr = subprocess.STDOUT if capture_output else None process = subprocess.Popen( - command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, cwd=svn_dir, universal_newlines=True) + command, stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, + cwd=svn_dir, universal_newlines=True) output, _ = process.communicate() if process.returncode != 0: raise RuntimeError(