hgweb: don't attempt to show hidden bookmarks (issue3774) stable
authorKevin Bullock <kbullock@ringworld.org>
Fri, 25 Jan 2013 11:43:54 -0600
branchstable
changeset 18478 886936ecc21b
parent 18477 010d6d3fcfee
child 18479 0efd5686f80c
hgweb: don't attempt to show hidden bookmarks (issue3774) localrepository._bookmarks is unfiltered, but hgweb gets a filtered repo. This fixes the resulting traceback on the 'bookmarks' page.
mercurial/hgweb/webcommands.py
tests/test-hgweb-commands.t
--- a/mercurial/hgweb/webcommands.py	Fri Jan 25 14:50:18 2013 -0600
+++ b/mercurial/hgweb/webcommands.py	Fri Jan 25 11:43:54 2013 -0600
@@ -424,7 +424,7 @@
                 latestentry=lambda **x: entries(True, True, **x))
 
 def bookmarks(web, req, tmpl):
-    i = web.repo._bookmarks.items()
+    i = [b for b in web.repo._bookmarks.items() if b[1] in web.repo]
     parity = paritygen(web.stripecount)
 
     def entries(latestonly, **map):
--- a/tests/test-hgweb-commands.t	Fri Jan 25 14:50:18 2013 -0600
+++ b/tests/test-hgweb-commands.t	Fri Jan 25 11:43:54 2013 -0600
@@ -1370,4 +1370,20 @@
 
   $ cat errors.log
 
+issue3774
+
+  $ hg phase -fs 4
+  $ hg bookmark -r4 secret
+  $ cat > hgweb.cgi <<HGWEB
+  > from mercurial import demandimport; demandimport.enable()
+  > from mercurial.hgweb import hgweb
+  > from mercurial.hgweb import wsgicgi
+  > app = hgweb('.', 'test')
+  > wsgicgi.launch(app)
+  > HGWEB
+  $ . "$TESTDIR/cgienv"
+  $ PATH_INFO=/bookmarks; export PATH_INFO
+  $ QUERY_STRING='style=raw'
+  $ python hgweb.cgi
+
   $ cd ..