webcommands: move from dict() construction to {} literals
authorAugie Fackler <raf@durin42.com>
Wed, 12 Mar 2014 13:29:07 -0400
changeset 20678 da6bea33007b
parent 20677 0e757575aef5
child 20679 0916f829eb8d
webcommands: move from dict() construction to {} literals The latter are both faster and more consistent across Python 2 and 3.
mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Wed Mar 12 13:15:37 2014 -0400
+++ b/mercurial/hgweb/webcommands.py	Wed Mar 12 13:29:07 2014 -0400
@@ -1018,26 +1018,26 @@
                              [cgi.escape(x) for x in ctx.tags()],
                              [cgi.escape(x) for x in ctx.bookmarks()]))
             else:
-                edgedata = [dict(col=edge[0], nextcol=edge[1],
-                                 color=(edge[2] - 1) % 6 + 1,
-                                 width=edge[3], bcolor=edge[4])
+                edgedata = [{'col': edge[0], 'nextcol': edge[1],
+                             'color': (edge[2] - 1) % 6 + 1,
+                             'width': edge[3], 'bcolor': edge[4]}
                             for edge in edges]
 
                 data.append(
-                    dict(node=node,
-                         col=vtx[0],
-                         color=(vtx[1] - 1) % 6 + 1,
-                         edges=edgedata,
-                         row=row,
-                         nextrow=row + 1,
-                         desc=desc,
-                         user=user,
-                         age=age,
-                         bookmarks=webutil.nodebookmarksdict(
-                            web.repo, ctx.node()),
-                         branches=webutil.nodebranchdict(web.repo, ctx),
-                         inbranch=webutil.nodeinbranch(web.repo, ctx),
-                         tags=webutil.nodetagsdict(web.repo, ctx.node())))
+                    {'node': node,
+                     'col': vtx[0],
+                     'color': (vtx[1] - 1) % 6 + 1,
+                     'edges': edgedata,
+                     'row': row,
+                     'nextrow': row + 1,
+                     'desc': desc,
+                     'user': user,
+                     'age': age,
+                     'bookmarks': webutil.nodebookmarksdict(
+                         web.repo, ctx.node()),
+                     'branches': webutil.nodebranchdict(web.repo, ctx),
+                     'inbranch': webutil.nodeinbranch(web.repo, ctx),
+                     'tags': webutil.nodetagsdict(web.repo, ctx.node())})
 
             row += 1