Patchwork [13,of,18,helps-py3] templatekw: move from dict() construction to {} literals

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2014, 5:40 p.m.
Message ID <6cb419dd3703ed59fc03.1394646047@augie-macbookair>
Download mbox | patch
Permalink /patch/3929/
State Accepted
Commit 6cb419dd3703ed59fc03c3996916e87a880a4f02
Headers show

Comments

Augie Fackler - March 12, 2014, 5:40 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1394644842 14400
#      Wed Mar 12 13:20:42 2014 -0400
# Node ID 6cb419dd3703ed59fc03c3996916e87a880a4f02
# Parent  7f8cbaaa8eea0c4d64561085d39d91fef21ce8fd
templatekw: move from dict() construction to {} literals

The latter are both faster and more consistent across Python 2 and 3.

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -301,8 +301,8 @@ 
 def showmanifest(**args):
     repo, ctx, templ = args['repo'], args['ctx'], args['templ']
     args = args.copy()
-    args.update(dict(rev=repo.manifest.rev(ctx.changeset()[0]),
-                     node=hex(ctx.changeset()[0])))
+    args.update({'rev': repo.manifest.rev(ctx.changeset()[0]),
+                 'node': hex(ctx.changeset()[0])})
     return templ('manifest', **args)
 
 def shownode(repo, ctx, templ, **args):