extdiff: move from dict() construction to {} literals
authorAugie Fackler <raf@durin42.com>
Wed, 12 Mar 2014 13:13:42 -0400
changeset 20674 2aafd5854243
parent 20673 37cde285b89c
child 20675 f8d50add83e1
extdiff: move from dict() construction to {} literals The latter are both faster and more consistent across Python 2 and 3.
hgext/extdiff.py
--- a/hgext/extdiff.py	Wed Mar 12 13:13:10 2014 -0400
+++ b/hgext/extdiff.py	Wed Mar 12 13:13:42 2014 -0400
@@ -207,10 +207,10 @@
         # 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 @@
     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