Skip to content
This repository has been archived by the owner on Feb 25, 2018. It is now read-only.

Commit

Permalink
silence confusing output from hg update null
Browse files Browse the repository at this point in the history
  • Loading branch information
rfk committed Oct 4, 2011
1 parent 23eaa53 commit 89b119e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.txt
@@ -1,4 +1,8 @@


v0.1.1:

* trim down output for some hg commands, to reduce noise and confusion.

v0.1.0: v0.1.0:


* initial release - you might say *everything* has changed... * initial release - you might say *everything* has changed...
Expand Down
6 changes: 4 additions & 2 deletions git_remote_hg/__init__.py
Expand Up @@ -171,12 +171,14 @@ def __init__(self, git_dir, hg_url):


def _do(self, *cmd, **kwds): def _do(self, *cmd, **kwds):
"""Run a hg command, capturing and reporting output.""" """Run a hg command, capturing and reporting output."""
silent = kwds.pop("silent", False)
kwds["stdout"] = subprocess.PIPE kwds["stdout"] = subprocess.PIPE
kwds["stderr"] = subprocess.STDOUT kwds["stderr"] = subprocess.STDOUT
p = subprocess.Popen(cmd, **kwds) p = subprocess.Popen(cmd, **kwds)
output = p.stdout.readline() output = p.stdout.readline()
while output: while output:
print>>sys.stderr, "hg :: " + output.strip() if not silent:
print>>sys.stderr, "hg :: " + output.strip()
output = p.stdout.readline() output = p.stdout.readline()
p.wait() p.wait()


Expand All @@ -198,7 +200,7 @@ def initialize_hg_repo(self):
if not os.path.isdir(os.path.dirname(hg_repo_dir)): if not os.path.isdir(os.path.dirname(hg_repo_dir)):
os.makedirs(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", "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: with open(os.path.join(hg_repo_dir, "README.txt"), "wt") as f:
f.write(dedent(""" f.write(dedent("""
This is a bare mercurial checkout created by git-remote-hg. This is a bare mercurial checkout created by git-remote-hg.
Expand Down

0 comments on commit 89b119e

Please sign in to comment.