From patchwork Tue Feb 5 17:38:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: hgweb: make 'summary' work with hidden changesets From: Kevin Bullock X-Patchwork-Id: 808 Message-Id: <5d02f1d86c2e172d82eb.1360085924@x-128-101-230-36.uofm-secure.wireless.umn.edu> To: mercurial-devel@selenic.com Date: Tue, 05 Feb 2013 11:38:44 -0600 # HG changeset patch # User Kevin Bullock # Date 1360085503 21600 # Branch stable # Node ID 5d02f1d86c2e172d82eba98bc3248f3101c91bc4 # Parent b31e0be96c79156b8236b12315a6f699c1bf992a hgweb: make 'summary' work with hidden changesets Since the 'summary' view used by e.g. gitweb and monoblue shows both a changelog and a bookmarks list, the same changes are needed here as were made to the 'changelog' and 'bookmarks' web commands (56ca4443a343 and 886936ecc21b, respectively). diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -497,8 +497,8 @@ def summary(web, req, tmpl): def bookmarks(**map): parity = paritygen(web.stripecount) - b = web.repo._bookmarks.items() - for k, n in sorted(b)[:10]: # limit to 10 bookmarks + marks = [b for b in web.repo._bookmarks.items() if b[1] in web.repo] + for k, n in sorted(marks)[:10]: # limit to 10 bookmarks yield {'parity': parity.next(), 'bookmark': k, 'date': web.repo[n].date(), @@ -518,7 +518,10 @@ def summary(web, req, tmpl): def changelist(**map): parity = paritygen(web.stripecount, offset=start - end) l = [] # build a list in forward order for efficiency - for i in xrange(start, end): + revs = [] + if start < end: + revs = web.repo.changelog.revs(start, end - 1) + for i in revs: ctx = web.repo[i] n = ctx.node() hn = hex(n) diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t --- a/tests/test-hgweb-commands.t +++ b/tests/test-hgweb-commands.t @@ -1399,6 +1399,14 @@ search works with filtering $ grep Status search Status: 200 Script output follows\r (esc) +summary works with filtering (issue3810) + + $ PATH_INFO=/summary; export PATH_INFO + $ QUERY_STRING='style=monoblue'; export QUERY_STRING + $ python hgweb.cgi > summary.out + $ grep ^Status summary.out + Status: 200 Script output follows\r (esc) + proper status for filtered revision