[PATCH 06 of 18 helps-py3] filemerge: move from dict() construction to {} literals
Augie Fackler
raf at durin42.com
Wed Mar 12 12:40:40 CDT 2014
# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1394644509 14400
# Wed Mar 12 13:15:09 2014 -0400
# Node ID 89b2336e5ccfdbdc2282b9bfd54127f54074ae3e
# Parent f8d50add83e18d2f078cb34672cb8198eef91e92
filemerge: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -248,20 +248,21 @@
tool, toolpath, binary, symlink = toolconf
a, b, c, back = files
out = ""
- env = dict(HG_FILE=fcd.path(),
- HG_MY_NODE=short(mynode),
- HG_OTHER_NODE=str(fco.changectx()),
- HG_BASE_NODE=str(fca.changectx()),
- HG_MY_ISLINK='l' in fcd.flags(),
- HG_OTHER_ISLINK='l' in fco.flags(),
- HG_BASE_ISLINK='l' in fca.flags())
+ env = {'HG_FILE': fcd.path(),
+ 'HG_MY_NODE': short(mynode),
+ 'HG_OTHER_NODE': str(fco.changectx()),
+ 'HG_BASE_NODE': str(fca.changectx()),
+ 'HG_MY_ISLINK': 'l' in fcd.flags(),
+ 'HG_OTHER_ISLINK': 'l' in fco.flags(),
+ 'HG_BASE_ISLINK': 'l' in fca.flags(),
+ }
ui = repo.ui
args = _toolstr(ui, tool, "args", '$local $base $other')
if "$output" in args:
out, a = a, back # read input from backup, write to original
- replace = dict(local=a, base=b, other=c, output=out)
+ replace = {'local': a, 'base': b, 'other': c, 'output': out}
args = util.interpolate(r'\$', replace, args,
lambda s: util.shellquote(util.localpath(s)))
r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
More information about the Mercurial-devel
mailing list