mercurial/hgweb/webcommands.py
changeset 28711 06ae7a6daad0
parent 28710 ca0c0ca30c62
child 28712 80e922479891
equal deleted inserted replaced
28710:ca0c0ca30c62 28711:06ae7a6daad0
   604     No arguments are accepted.
   604     No arguments are accepted.
   605 
   605 
   606     The ``bookmarks`` template is rendered.
   606     The ``bookmarks`` template is rendered.
   607     """
   607     """
   608     i = [b for b in web.repo._bookmarks.items() if b[1] in web.repo]
   608     i = [b for b in web.repo._bookmarks.items() if b[1] in web.repo]
   609     i = sorted(i)
   609     sortkey = lambda b: (web.repo[b[1]].rev(), b[0])
       
   610     i = sorted(i, key=sortkey, reverse=True)
   610     parity = paritygen(web.stripecount)
   611     parity = paritygen(web.stripecount)
   611 
   612 
   612     def entries(latestonly, **map):
   613     def entries(latestonly, **map):
   613         t = i
   614         t = i
   614         if latestonly:
   615         if latestonly:
   676                        date=web.repo[n].date())
   677                        date=web.repo[n].date())
   677 
   678 
   678     def bookmarks(**map):
   679     def bookmarks(**map):
   679         parity = paritygen(web.stripecount)
   680         parity = paritygen(web.stripecount)
   680         marks = [b for b in web.repo._bookmarks.items() if b[1] in web.repo]
   681         marks = [b for b in web.repo._bookmarks.items() if b[1] in web.repo]
   681         for k, n in sorted(marks)[:10]:  # limit to 10 bookmarks
   682         sortkey = lambda b: (web.repo[b[1]].rev(), b[0])
       
   683         marks = sorted(marks, key=sortkey, reverse=True)
       
   684         for k, n in marks[:10]:  # limit to 10 bookmarks
   682             yield {'parity': parity.next(),
   685             yield {'parity': parity.next(),
   683                    'bookmark': k,
   686                    'bookmark': k,
   684                    'date': web.repo[n].date(),
   687                    'date': web.repo[n].date(),
   685                    'node': hex(n)}
   688                    'node': hex(n)}
   686 
   689