comparison mercurial/hgweb/webcommands.py @ 28712:80e922479891

hgweb: generate last change date for an empty atom-bookmarks feed (issue5022) RFC 4287 states that atom feeds must have an <updated> element, so let's add one even when repo doesn't have a single bookmark.
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 31 Mar 2016 15:37:21 +0800
parents 06ae7a6daad0
children ead25aa27a43
comparison
equal deleted inserted replaced
28711:06ae7a6daad0 28712:80e922479891
618 yield {"parity": parity.next(), 618 yield {"parity": parity.next(),
619 "bookmark": k, 619 "bookmark": k,
620 "date": web.repo[n].date(), 620 "date": web.repo[n].date(),
621 "node": hex(n)} 621 "node": hex(n)}
622 622
623 if i:
624 latestrev = i[0][1]
625 else:
626 latestrev = -1
627
623 return tmpl("bookmarks", 628 return tmpl("bookmarks",
624 node=hex(web.repo.changelog.tip()), 629 node=hex(web.repo.changelog.tip()),
630 lastchange=[{"date": web.repo[latestrev].date()}],
625 entries=lambda **x: entries(latestonly=False, **x), 631 entries=lambda **x: entries(latestonly=False, **x),
626 latestentry=lambda **x: entries(latestonly=True, **x)) 632 latestentry=lambda **x: entries(latestonly=True, **x))
627 633
628 @webcommand('branches') 634 @webcommand('branches')
629 def branches(web, req, tmpl): 635 def branches(web, req, tmpl):