comparison mercurial/filemerge.py @ 20676:89b2336e5ccf

filemerge: move from dict() construction to {} literals The latter are both faster and more consistent across Python 2 and 3.
author Augie Fackler <raf@durin42.com>
date Wed, 12 Mar 2014 13:15:09 -0400
parents c58b6ab4c26f
children 098a274764b3
comparison
equal deleted inserted replaced
20675:f8d50add83e1 20676:89b2336e5ccf
246 r = _premerge(repo, toolconf, files) 246 r = _premerge(repo, toolconf, files)
247 if r: 247 if r:
248 tool, toolpath, binary, symlink = toolconf 248 tool, toolpath, binary, symlink = toolconf
249 a, b, c, back = files 249 a, b, c, back = files
250 out = "" 250 out = ""
251 env = dict(HG_FILE=fcd.path(), 251 env = {'HG_FILE': fcd.path(),
252 HG_MY_NODE=short(mynode), 252 'HG_MY_NODE': short(mynode),
253 HG_OTHER_NODE=str(fco.changectx()), 253 'HG_OTHER_NODE': str(fco.changectx()),
254 HG_BASE_NODE=str(fca.changectx()), 254 'HG_BASE_NODE': str(fca.changectx()),
255 HG_MY_ISLINK='l' in fcd.flags(), 255 'HG_MY_ISLINK': 'l' in fcd.flags(),
256 HG_OTHER_ISLINK='l' in fco.flags(), 256 'HG_OTHER_ISLINK': 'l' in fco.flags(),
257 HG_BASE_ISLINK='l' in fca.flags()) 257 'HG_BASE_ISLINK': 'l' in fca.flags(),
258 }
258 259
259 ui = repo.ui 260 ui = repo.ui
260 261
261 args = _toolstr(ui, tool, "args", '$local $base $other') 262 args = _toolstr(ui, tool, "args", '$local $base $other')
262 if "$output" in args: 263 if "$output" in args:
263 out, a = a, back # read input from backup, write to original 264 out, a = a, back # read input from backup, write to original
264 replace = dict(local=a, base=b, other=c, output=out) 265 replace = {'local': a, 'base': b, 'other': c, 'output': out}
265 args = util.interpolate(r'\$', replace, args, 266 args = util.interpolate(r'\$', replace, args,
266 lambda s: util.shellquote(util.localpath(s))) 267 lambda s: util.shellquote(util.localpath(s)))
267 r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env, 268 r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
268 out=ui.fout) 269 out=ui.fout)
269 return True, r 270 return True, r