[pypy-commit] pypy default: replace use of commands.getoutput with subprocess.check_output
bdkearns
noreply at buildbot.pypy.org
Mon Jan 28 23:25:09 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r60638:7bf65ca5bf56
Date: 2013-01-28 17:22 -0500
http://bitbucket.org/pypy/pypy/changeset/7bf65ca5bf56/
Log: replace use of commands.getoutput with subprocess.check_output
diff --git a/pypy/doc/test/test_whatsnew.py b/pypy/doc/test/test_whatsnew.py
--- a/pypy/doc/test/test_whatsnew.py
+++ b/pypy/doc/test/test_whatsnew.py
@@ -1,6 +1,6 @@
import py
import pypy
-from commands import getoutput
+from subprocess import check_output
ROOT = py.path.local(pypy.__file__).dirpath().dirpath()
@@ -29,8 +29,8 @@
merge() and \
branch(default)) and \
not branch(default)' % (startrev, endrev)
- cmd = r'hg log -R "%s" -r "%s" --template "{branches}\n"' % (path, revset)
- out = getoutput(cmd)
+ cmd = ['hg', 'log', '-R', str(path), '-r', revset, '--template', '{branches}\n']
+ out = check_output(cmd)
branches = set(map(str.strip, out.splitlines()))
return branches
diff --git a/pypy/tool/clean_old_branches.py b/pypy/tool/clean_old_branches.py
--- a/pypy/tool/clean_old_branches.py
+++ b/pypy/tool/clean_old_branches.py
@@ -6,15 +6,15 @@
import os
import sys
-import commands
+import subprocess
if not os.path.isdir('.hg'):
print 'Must run this script from the top-level directory.'
sys.exit(1)
def heads():
- result = commands.getoutput(
- "hg heads --topo --closed --template '{node|short}:{branches}:{extras}\n'")
+ result = subprocess.check_output(
+ ['hg', 'heads', '--topo', '--closed', '--template', '{node|short}:{branches}:{extras}\n'])
result = result.splitlines(False)
result = [s.split(':', 2) for s in result]
for line in result:
More information about the pypy-commit
mailing list