Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 10282:08a0f04b56bd
many, many trivial check-code fixups
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 25 Jan 2010 00:05:27 -0600 |
parents | d6512b3e9ac0 |
children | 4612cded5176 |
comparison
equal
deleted
inserted
replaced
10281:e7d3b509af8b | 10282:08a0f04b56bd |
---|---|
226 count = len(cl) | 226 count = len(cl) |
227 pos = ctx.rev() | 227 pos = ctx.rev() |
228 start = max(0, pos - revcount + 1) | 228 start = max(0, pos - revcount + 1) |
229 end = min(count, start + revcount) | 229 end = min(count, start + revcount) |
230 pos = end - 1 | 230 pos = end - 1 |
231 parity = paritygen(web.stripecount, offset=start-end) | 231 parity = paritygen(web.stripecount, offset=start - end) |
232 | 232 |
233 changenav = webutil.revnavgen(pos, revcount, count, web.repo.changectx) | 233 changenav = webutil.revnavgen(pos, revcount, count, web.repo.changectx) |
234 | 234 |
235 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, | 235 return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav, |
236 node=hex(ctx.node()), rev=pos, changesets=count, | 236 node=hex(ctx.node()), rev=pos, changesets=count, |
332 for d in sorted(dirs): | 332 for d in sorted(dirs): |
333 | 333 |
334 emptydirs = [] | 334 emptydirs = [] |
335 h = dirs[d] | 335 h = dirs[d] |
336 while isinstance(h, dict) and len(h) == 1: | 336 while isinstance(h, dict) and len(h) == 1: |
337 k,v = h.items()[0] | 337 k, v = h.items()[0] |
338 if v: | 338 if v: |
339 emptydirs.append(k) | 339 emptydirs.append(k) |
340 h = v | 340 h = v |
341 | 341 |
342 path = "%s%s" % (abspath, d) | 342 path = "%s%s" % (abspath, d) |
376 "date": web.repo[n].date(), | 376 "date": web.repo[n].date(), |
377 "node": hex(n)} | 377 "node": hex(n)} |
378 | 378 |
379 return tmpl("tags", | 379 return tmpl("tags", |
380 node=hex(web.repo.changelog.tip()), | 380 node=hex(web.repo.changelog.tip()), |
381 entries=lambda **x: entries(False,0, **x), | 381 entries=lambda **x: entries(False, 0, **x), |
382 entriesnotip=lambda **x: entries(True,0, **x), | 382 entriesnotip=lambda **x: entries(True, 0, **x), |
383 latestentry=lambda **x: entries(True,1, **x)) | 383 latestentry=lambda **x: entries(True, 1, **x)) |
384 | 384 |
385 def branches(web, req, tmpl): | 385 def branches(web, req, tmpl): |
386 b = web.repo.branchtags() | 386 b = web.repo.branchtags() |
387 tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems()) | 387 tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems()) |
388 heads = web.repo.heads() | 388 heads = web.repo.heads() |
435 def branches(**map): | 435 def branches(**map): |
436 parity = paritygen(web.stripecount) | 436 parity = paritygen(web.stripecount) |
437 | 437 |
438 b = web.repo.branchtags() | 438 b = web.repo.branchtags() |
439 l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()] | 439 l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()] |
440 for r,n,t in sorted(l): | 440 for r, n, t in sorted(l): |
441 yield {'parity': parity.next(), | 441 yield {'parity': parity.next(), |
442 'branch': t, | 442 'branch': t, |
443 'node': hex(n), | 443 'node': hex(n), |
444 'date': web.repo[n].date()} | 444 'date': web.repo[n].date()} |
445 | 445 |
446 def changelist(**map): | 446 def changelist(**map): |
447 parity = paritygen(web.stripecount, offset=start-end) | 447 parity = paritygen(web.stripecount, offset=start - end) |
448 l = [] # build a list in forward order for efficiency | 448 l = [] # build a list in forward order for efficiency |
449 for i in xrange(start, end): | 449 for i in xrange(start, end): |
450 ctx = web.repo[i] | 450 ctx = web.repo[i] |
451 n = ctx.node() | 451 n = ctx.node() |
452 hn = hex(n) | 452 hn = hex(n) |
598 morevars['revcount'] = revcount * 2 | 598 morevars['revcount'] = revcount * 2 |
599 | 599 |
600 count = fctx.filerev() + 1 | 600 count = fctx.filerev() + 1 |
601 start = max(0, fctx.filerev() - revcount + 1) # first rev on this page | 601 start = max(0, fctx.filerev() - revcount + 1) # first rev on this page |
602 end = min(count, start + revcount) # last rev on this page | 602 end = min(count, start + revcount) # last rev on this page |
603 parity = paritygen(web.stripecount, offset=start-end) | 603 parity = paritygen(web.stripecount, offset=start - end) |
604 | 604 |
605 def entries(limit=0, **map): | 605 def entries(limit=0, **map): |
606 l = [] | 606 l = [] |
607 | 607 |
608 repo = web.repo | 608 repo = web.repo |