hgwebdir_mod: move from dict() construction to {} literals
authorAugie Fackler <raf@durin42.com>
Wed, 12 Mar 2014 13:15:37 -0400
changeset 20677 0e757575aef5
parent 20676 89b2336e5ccf
child 20678 da6bea33007b
hgwebdir_mod: move from dict() construction to {} literals The latter are both faster and more consistent across Python 2 and 3.
mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Wed Mar 12 13:15:09 2014 -0400
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Mar 12 13:15:37 2014 -0400
@@ -308,17 +308,17 @@
 
                     # add '/' to the name to make it obvious that
                     # the entry is a directory, not a regular repository
-                    row = dict(contact="",
-                               contact_sort="",
-                               name=name + '/',
-                               name_sort=name,
-                               url=url,
-                               description="",
-                               description_sort="",
-                               lastchange=d,
-                               lastchange_sort=d[1]-d[0],
-                               archives=[],
-                               isdirectory=True)
+                    row = {'contact': "",
+                           'contact_sort': "",
+                           'name': name + '/',
+                           'name_sort': name,
+                           'url': url,
+                           'description': "",
+                           'description_sort': "",
+                           'lastchange': d,
+                           'lastchange_sort': d[1]-d[0],
+                           'archives': [],
+                           'isdirectory': True}
 
                     seendirs.add(name)
                     yield row
@@ -356,17 +356,18 @@
                 contact = get_contact(get)
                 description = get("web", "description", "")
                 name = get("web", "name", name)
-                row = dict(contact=contact or "unknown",
-                           contact_sort=contact.upper() or "unknown",
-                           name=name,
-                           name_sort=name,
-                           url=url,
-                           description=description or "unknown",
-                           description_sort=description.upper() or "unknown",
-                           lastchange=d,
-                           lastchange_sort=d[1]-d[0],
-                           archives=archivelist(u, "tip", url),
-                           isdirectory=None)
+                row = {'contact': contact or "unknown",
+                       'contact_sort': contact.upper() or "unknown",
+                       'name': name,
+                       'name_sort': name,
+                       'url': url,
+                       'description': description or "unknown",
+                       'description_sort': description.upper() or "unknown",
+                       'lastchange': d,
+                       'lastchange_sort': d[1]-d[0],
+                       'archives': archivelist(u, "tip", url),
+                       'isdirectory': None,
+                       }
 
                 seenrepos.add(name)
                 yield row