Show More
@@ -639,35 +639,10 b' def branches(web, req, tmpl):' | |||
|
639 | 639 | |
|
640 | 640 | The ``branches`` template is rendered. |
|
641 | 641 | """ |
|
642 | tips = [] | |
|
643 | heads = web.repo.heads() | |
|
644 | parity = paritygen(web.stripecount) | |
|
645 | sortkey = lambda item: (not item[1], item[0].rev()) | |
|
646 | ||
|
647 | def entries(limit, **map): | |
|
648 | count = 0 | |
|
649 | if not tips: | |
|
650 | for tag, hs, tip, closed in web.repo.branchmap().iterbranches(): | |
|
651 | tips.append((web.repo[tip], closed)) | |
|
652 | for ctx, closed in sorted(tips, key=sortkey, reverse=True): | |
|
653 | if limit > 0 and count >= limit: | |
|
654 | return | |
|
655 | count += 1 | |
|
656 | if closed: | |
|
657 | status = 'closed' | |
|
658 | elif ctx.node() not in heads: | |
|
659 | status = 'inactive' | |
|
660 | else: | |
|
661 | status = 'open' | |
|
662 | yield {'parity': parity.next(), | |
|
663 | 'branch': ctx.branch(), | |
|
664 | 'status': status, | |
|
665 | 'node': ctx.hex(), | |
|
666 | 'date': ctx.date()} | |
|
667 | ||
|
642 | entries = webutil.branchentries(web.repo, web.stripecount) | |
|
643 | latestentry = webutil.branchentries(web.repo, web.stripecount, 1) | |
|
668 | 644 | return tmpl('branches', node=hex(web.repo.changelog.tip()), |
|
669 |
entries= |
|
|
670 | latestentry=lambda **x: entries(1, **x)) | |
|
645 | entries=entries, latestentry=latestentry) | |
|
671 | 646 | |
|
672 | 647 | @webcommand('summary') |
|
673 | 648 | def summary(web, req, tmpl): |
@@ -199,6 +199,37 b' def showbookmark(repo, tmpl, t1, node=nu' | |||
|
199 | 199 | for t in repo.nodebookmarks(node): |
|
200 | 200 | yield tmpl(t1, bookmark=t, **args) |
|
201 | 201 | |
|
202 | def branchentries(repo, stripecount, limit=0): | |
|
203 | tips = [] | |
|
204 | heads = repo.heads() | |
|
205 | parity = paritygen(stripecount) | |
|
206 | sortkey = lambda item: (not item[1], item[0].rev()) | |
|
207 | ||
|
208 | def entries(**map): | |
|
209 | count = 0 | |
|
210 | if not tips: | |
|
211 | for tag, hs, tip, closed in repo.branchmap().iterbranches(): | |
|
212 | tips.append((repo[tip], closed)) | |
|
213 | for ctx, closed in sorted(tips, key=sortkey, reverse=True): | |
|
214 | if limit > 0 and count >= limit: | |
|
215 | return | |
|
216 | count += 1 | |
|
217 | if closed: | |
|
218 | status = 'closed' | |
|
219 | elif ctx.node() not in heads: | |
|
220 | status = 'inactive' | |
|
221 | else: | |
|
222 | status = 'open' | |
|
223 | yield { | |
|
224 | 'parity': parity.next(), | |
|
225 | 'branch': ctx.branch(), | |
|
226 | 'status': status, | |
|
227 | 'node': ctx.hex(), | |
|
228 | 'date': ctx.date() | |
|
229 | } | |
|
230 | ||
|
231 | return entries | |
|
232 | ||
|
202 | 233 | def cleanpath(repo, path): |
|
203 | 234 | path = path.lstrip('/') |
|
204 | 235 | return pathutil.canonpath(repo.root, '', path) |
General Comments 0
You need to be logged in to leave comments.
Login now