Commit 72a59cec authored by Russ Cox's avatar Russ Cox

require Mercurial 1.3 again (how did that get dropped?)

avoid deprecation warning about os.popen3

R=r
http://go/go-review/1026018
parent cdcb0413
......@@ -51,6 +51,28 @@ except:
from mercurial.version import version as v
hgversion = v.get_version()
oldMessage = """
The code review extension requires Mercurial 1.3 or newer.
To install a new Mercurial,
sudo easy_install mercurial
works on most systems.
"""
linuxMessage = """
You may need to clear your current Mercurial installation by running:
sudo apt-get remove mercurial mercurial-common
sudo rm -rf /etc/mercurial
"""
if hgversion < '1.3':
msg = oldMessage
if os.access("/etc/mercurial", 0):
msg += linuxMessage
raise util.Abort(msg)
# To experiment with Mercurial in the python interpreter:
# >>> repo = hg.repository(ui.ui(), path = ".")
......@@ -584,12 +606,13 @@ def CheckGofmt(ui, repo, files, just_warn=False):
cwd = os.getcwd()
files = [RelativePath(repo.root + '/' + f, cwd) for f in files]
try:
stdin, stdout, stderr = os.popen3(["gofmt", "-l"] + files)
stdin.close()
cmd = subprocess.Popen(["gofmt", "-l"] + files, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
cmd.stdin.close()
except:
raise util.Abort("gofmt: " + ExceptionDetail())
data = stdout.read()
errors = stderr.read()
data = cmd.stdout.read()
errors = cmd.stderr.read()
cmd.wait()
if len(errors) > 0:
ui.warn("gofmt errors:\n" + errors.rstrip() + "\n")
return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment