# HG changeset patch # User Augie Fackler # Date 2014-03-12 17:13:42 # Node ID 2aafd5854243fda6272085846a435e3412e1b9d5 # Parent 37cde285b89c8f943c127d7f06aa25d92c399632 extdiff: move from dict() construction to {} literals The latter are both faster and more consistent across Python 2 and 3. diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -207,10 +207,10 @@ def dodiff(ui, repo, diffcmd, diffopts, # Function to quote file/dir names in the argument string. # When not operating in 3-way mode, an empty string is # returned for parent2 - replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b, - plabel1=label1a, plabel2=label1b, - clabel=label2, child=dir2, - root=repo.root) + replace = {'parent': dir1a, 'parent1': dir1a, 'parent2': dir1b, + 'plabel1': label1a, 'plabel2': label1b, + 'clabel': label2, 'child': dir2, + 'root': repo.root} def quote(match): key = match.group()[1:] if not do3way and key == 'parent2': @@ -316,7 +316,7 @@ use %(path)s to diff repository (or sele that revision is compared to the working directory, and, when no revisions are specified, the working directory files are compared to its parent.\ -''') % dict(path=util.uirepr(path)) +''') % {'path': util.uirepr(path)} # We must translate the docstring right away since it is # used as a format string. The string will unfortunately