# HG changeset patch # User Anton Shestakov # Date 1459409841 -28800 # Node ID 80e922479891794d15f45c925fa218cdcec9544c # Parent 06ae7a6daad0d6e313d6121284869049b95607ee hgweb: generate last change date for an empty atom-bookmarks feed (issue5022) RFC 4287 states that atom feeds must have an element, so let's add one even when repo doesn't have a single bookmark. diff -r 06ae7a6daad0 -r 80e922479891 mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Thu Mar 31 15:22:06 2016 +0800 +++ b/mercurial/hgweb/webcommands.py Thu Mar 31 15:37:21 2016 +0800 @@ -620,8 +620,14 @@ "date": web.repo[n].date(), "node": hex(n)} + if i: + latestrev = i[0][1] + else: + latestrev = -1 + return tmpl("bookmarks", node=hex(web.repo.changelog.tip()), + lastchange=[{"date": web.repo[latestrev].date()}], entries=lambda **x: entries(latestonly=False, **x), latestentry=lambda **x: entries(latestonly=True, **x)) diff -r 06ae7a6daad0 -r 80e922479891 mercurial/templates/atom/bookmarks.tmpl --- a/mercurial/templates/atom/bookmarks.tmpl Thu Mar 31 15:22:06 2016 +0800 +++ b/mercurial/templates/atom/bookmarks.tmpl Thu Mar 31 15:37:21 2016 +0800 @@ -5,7 +5,7 @@ {repo|escape}: bookmarks {repo|escape} bookmark history Mercurial SCM - {latestentry%feedupdated} + {lastchange%feedupdated} {entries%bookmarkentry} diff -r 06ae7a6daad0 -r 80e922479891 tests/test-hgweb-empty.t --- a/tests/test-hgweb-empty.t Thu Mar 31 15:22:06 2016 +0800 +++ b/tests/test-hgweb-empty.t Thu Mar 31 15:37:21 2016 +0800 @@ -472,7 +472,7 @@ test: bookmarks test bookmark history Mercurial SCM - + 1970-01-01T00:00:00+00:00