Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 38169:e4a43d261715
hgweb: wrap {bookmarks} of summary with mappinggenerator
No bare generator of mappings should be put in a template mapping.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 04 Apr 2018 20:24:04 +0900 |
parents | 5e94d07b290a |
children | 3e6253438bf9 |
comparison
equal
deleted
inserted
replaced
38168:5e94d07b290a | 38169:e4a43d261715 |
---|---|
725 'tag': k, | 725 'tag': k, |
726 'node': hex(n), | 726 'node': hex(n), |
727 'date': web.repo[n].date(), | 727 'date': web.repo[n].date(), |
728 } | 728 } |
729 | 729 |
730 def bookmarks(**map): | 730 def bookmarks(context): |
731 parity = paritygen(web.stripecount) | 731 parity = paritygen(web.stripecount) |
732 marks = [b for b in web.repo._bookmarks.items() if b[1] in web.repo] | 732 marks = [b for b in web.repo._bookmarks.items() if b[1] in web.repo] |
733 sortkey = lambda b: (web.repo[b[1]].rev(), b[0]) | 733 sortkey = lambda b: (web.repo[b[1]].rev(), b[0]) |
734 marks = sorted(marks, key=sortkey, reverse=True) | 734 marks = sorted(marks, key=sortkey, reverse=True) |
735 for k, n in marks[:10]: # limit to 10 bookmarks | 735 for k, n in marks[:10]: # limit to 10 bookmarks |
767 'summary', | 767 'summary', |
768 desc=desc, | 768 desc=desc, |
769 owner=get_contact(web.config) or 'unknown', | 769 owner=get_contact(web.config) or 'unknown', |
770 lastchange=tip.date(), | 770 lastchange=tip.date(), |
771 tags=templateutil.mappinggenerator(tagentries, name='tagentry'), | 771 tags=templateutil.mappinggenerator(tagentries, name='tagentry'), |
772 bookmarks=bookmarks, | 772 bookmarks=templateutil.mappinggenerator(bookmarks), |
773 branches=webutil.branchentries(web.repo, web.stripecount, 10), | 773 branches=webutil.branchentries(web.repo, web.stripecount, 10), |
774 shortlog=templateutil.mappinggenerator(changelist, | 774 shortlog=templateutil.mappinggenerator(changelist, |
775 name='shortlogentry'), | 775 name='shortlogentry'), |
776 node=tip.hex(), | 776 node=tip.hex(), |
777 symrev='tip', | 777 symrev='tip', |