comparison mercurial/hgweb/hgwebdir_mod.py @ 20677:0e757575aef5

hgwebdir_mod: move from dict() construction to {} literals The latter are both faster and more consistent across Python 2 and 3.
author Augie Fackler <raf@durin42.com>
date Wed, 12 Mar 2014 13:15:37 -0400
parents 3d77e567de56
children 49f2d5644f04
comparison
equal deleted inserted replaced
20676:89b2336e5ccf 20677:0e757575aef5
306 except OSError: 306 except OSError:
307 continue 307 continue
308 308
309 # add '/' to the name to make it obvious that 309 # add '/' to the name to make it obvious that
310 # the entry is a directory, not a regular repository 310 # the entry is a directory, not a regular repository
311 row = dict(contact="", 311 row = {'contact': "",
312 contact_sort="", 312 'contact_sort': "",
313 name=name + '/', 313 'name': name + '/',
314 name_sort=name, 314 'name_sort': name,
315 url=url, 315 'url': url,
316 description="", 316 'description': "",
317 description_sort="", 317 'description_sort': "",
318 lastchange=d, 318 'lastchange': d,
319 lastchange_sort=d[1]-d[0], 319 'lastchange_sort': d[1]-d[0],
320 archives=[], 320 'archives': [],
321 isdirectory=True) 321 'isdirectory': True}
322 322
323 seendirs.add(name) 323 seendirs.add(name)
324 yield row 324 yield row
325 continue 325 continue
326 326
354 continue 354 continue
355 355
356 contact = get_contact(get) 356 contact = get_contact(get)
357 description = get("web", "description", "") 357 description = get("web", "description", "")
358 name = get("web", "name", name) 358 name = get("web", "name", name)
359 row = dict(contact=contact or "unknown", 359 row = {'contact': contact or "unknown",
360 contact_sort=contact.upper() or "unknown", 360 'contact_sort': contact.upper() or "unknown",
361 name=name, 361 'name': name,
362 name_sort=name, 362 'name_sort': name,
363 url=url, 363 'url': url,
364 description=description or "unknown", 364 'description': description or "unknown",
365 description_sort=description.upper() or "unknown", 365 'description_sort': description.upper() or "unknown",
366 lastchange=d, 366 'lastchange': d,
367 lastchange_sort=d[1]-d[0], 367 'lastchange_sort': d[1]-d[0],
368 archives=archivelist(u, "tip", url), 368 'archives': archivelist(u, "tip", url),
369 isdirectory=None) 369 'isdirectory': None,
370 }
370 371
371 seenrepos.add(name) 372 seenrepos.add(name)
372 yield row 373 yield row
373 374
374 sortdefault = None, False 375 sortdefault = None, False