17 # __all__ is populated with the allowed commands. Be sure to add to it if |
17 # __all__ is populated with the allowed commands. Be sure to add to it if |
18 # you're adding a new command, or the new command won't work. |
18 # you're adding a new command, or the new command won't work. |
19 |
19 |
20 __all__ = [ |
20 __all__ = [ |
21 'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev', |
21 'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev', |
22 'manifest', 'tags', 'summary', 'filediff', 'diff', 'annotate', 'filelog', |
22 'manifest', 'tags', 'branches', 'summary', 'filediff', 'diff', 'annotate', |
23 'archive', 'static', 'graph', |
23 'filelog', 'archive', 'static', 'graph', |
24 ] |
24 ] |
25 |
25 |
26 def log(web, req, tmpl): |
26 def log(web, req, tmpl): |
27 if 'file' in req.form and req.form['file'][0]: |
27 if 'file' in req.form and req.form['file'][0]: |
28 return filelog(web, req, tmpl) |
28 return filelog(web, req, tmpl) |
356 node=hex(web.repo.changelog.tip()), |
356 node=hex(web.repo.changelog.tip()), |
357 entries=lambda **x: entries(False,0, **x), |
357 entries=lambda **x: entries(False,0, **x), |
358 entriesnotip=lambda **x: entries(True,0, **x), |
358 entriesnotip=lambda **x: entries(True,0, **x), |
359 latestentry=lambda **x: entries(True,1, **x)) |
359 latestentry=lambda **x: entries(True,1, **x)) |
360 |
360 |
|
361 def branches(web, req, tmpl): |
|
362 b = web.repo.branchtags() |
|
363 l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.iteritems()] |
|
364 parity = paritygen(web.stripecount) |
|
365 |
|
366 def entries(limit, **map): |
|
367 count = 0 |
|
368 for r, n, t in sorted(l): |
|
369 if limit > 0 and count >= limit: |
|
370 return |
|
371 count += 1 |
|
372 yield {'parity': parity.next(), |
|
373 'branch': t, |
|
374 'node': hex(n), |
|
375 'date': web.repo[n].date()} |
|
376 |
|
377 return tmpl('branches', node=hex(web.repo.changelog.tip()), |
|
378 entries=lambda **x: entries(0, **x), |
|
379 latestentry=lambda **x: entries(1, **x)) |
|
380 |
361 def summary(web, req, tmpl): |
381 def summary(web, req, tmpl): |
362 i = web.repo.tagslist() |
382 i = web.repo.tagslist() |
363 i.reverse() |
383 i.reverse() |
364 |
384 |
365 def tagentries(**map): |
385 def tagentries(**map): |