[PATCH 2 of 8] chgserver: use util.shellenviron
Jun Wu
quark at fb.com
Mon Jan 9 18:12:22 EST 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1484002731 -28800
# Tue Jan 10 06:58:51 2017 +0800
# Node ID 603c1d614690ab594f240f4daf198f34c1714f62
# Parent 25760899b0ad12660b6a9e8c7b928dd2c334ec80
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r 603c1d614690
chgserver: use util.shellenviron
This avoids code duplication.
diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -232,17 +232,6 @@ def _newchgui(srcui, csystem):
return super(chgui, self).system(cmd, environ, cwd, onerr,
errprefix)
- # copied from mercurial/util.py:system()
self.flush()
- def py2shell(val):
- if val is None or val is False:
- return '0'
- if val is True:
- return '1'
- return str(val)
- env = encoding.environ.copy()
- if environ:
- env.update((k, py2shell(v)) for k, v in environ.iteritems())
- env['HG'] = util.hgexecutable()
- rc = self._csystem(cmd, env, cwd)
+ rc = self._csystem(cmd, util.shellenviron(environ), cwd)
if rc and onerr:
errmsg = '%s %s' % (os.path.basename(cmd.split(None, 1)[0]),
More information about the Mercurial-devel
mailing list