Mercurial > hg-stable
comparison mercurial/hgweb/webcommands.py @ 7622:4dd7b28003d2
use dict.iteritems() rather than dict.items()
This should be faster and more future-proof. Calls where the result is to be
sorted using util.sort() have been left unchanged. Calls to .items() on
configparser objects have been left as-is, too.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 12 Jan 2009 09:16:03 +0100 |
parents | 069b29656401 |
children | 08cabecfa8a8 |
comparison
equal
deleted
inserted
replaced
7621:6d891df43a5f | 7622:4dd7b28003d2 |
---|---|
273 if path and path[-1] != "/": | 273 if path and path[-1] != "/": |
274 path += "/" | 274 path += "/" |
275 l = len(path) | 275 l = len(path) |
276 abspath = "/" + path | 276 abspath = "/" + path |
277 | 277 |
278 for f, n in mf.items(): | 278 for f, n in mf.iteritems(): |
279 if f[:l] != path: | 279 if f[:l] != path: |
280 continue | 280 continue |
281 remain = f[l:] | 281 remain = f[l:] |
282 elements = remain.split('/') | 282 elements = remain.split('/') |
283 if len(elements) == 1: | 283 if len(elements) == 1: |
384 | 384 |
385 def branches(**map): | 385 def branches(**map): |
386 parity = paritygen(web.stripecount) | 386 parity = paritygen(web.stripecount) |
387 | 387 |
388 b = web.repo.branchtags() | 388 b = web.repo.branchtags() |
389 l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.items()] | 389 l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()] |
390 for r,n,t in util.sort(l): | 390 for r,n,t in util.sort(l): |
391 yield {'parity': parity.next(), | 391 yield {'parity': parity.next(), |
392 'branch': t, | 392 'branch': t, |
393 'node': hex(n), | 393 'node': hex(n), |
394 'date': web.repo[n].date()} | 394 'date': web.repo[n].date()} |