From 89b119e713a0182dc6956716fabde8ff497341ff Mon Sep 17 00:00:00 2001 From: Ryan Kelly Date: Wed, 5 Oct 2011 10:01:26 +1100 Subject: [PATCH] silence confusing output from `hg update null` --- ChangeLog.txt | 4 ++++ git_remote_hg/__init__.py | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 973d5c5..7abb203 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,8 @@ +v0.1.1: + + * trim down output for some hg commands, to reduce noise and confusion. + v0.1.0: * initial release - you might say *everything* has changed... diff --git a/git_remote_hg/__init__.py b/git_remote_hg/__init__.py index 52de5d6..a2438ff 100755 --- a/git_remote_hg/__init__.py +++ b/git_remote_hg/__init__.py @@ -171,12 +171,14 @@ def __init__(self, git_dir, hg_url): def _do(self, *cmd, **kwds): """Run a hg command, capturing and reporting output.""" + silent = kwds.pop("silent", False) kwds["stdout"] = subprocess.PIPE kwds["stderr"] = subprocess.STDOUT p = subprocess.Popen(cmd, **kwds) output = p.stdout.readline() while output: - print>>sys.stderr, "hg :: " + output.strip() + if not silent: + print>>sys.stderr, "hg :: " + output.strip() output = p.stdout.readline() p.wait() @@ -198,7 +200,7 @@ def initialize_hg_repo(self): if not os.path.isdir(os.path.dirname(hg_repo_dir)): os.makedirs(os.path.dirname(hg_repo_dir)) self._do("hg", "clone", self.hg_url, hg_repo_dir) - self._do("hg", "update", "null", cwd=hg_repo_dir) + self._do("hg", "update", "null", cwd=hg_repo_dir, silent=True) with open(os.path.join(hg_repo_dir, "README.txt"), "wt") as f: f.write(dedent(""" This is a bare mercurial checkout created by git-remote-hg.