[PATCH 2 of 2] bookmarks: hide bookmarks on filtered revs from listkeys
Kevin Bullock
kbullock+mercurial at ringworld.org
Sun Jan 27 15:15:59 CST 2013
# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1359321233 21600
# Branch stable
# Node ID c7c39a1ddac8318572061e35e347f6570052b0f8
# Parent 14fe65a26547fe63963f4e6062b26f07a9443860
bookmarks: hide bookmarks on filtered revs from listkeys
Don't expose unserved changesets to remote repos. Thanks to Sean Farley
<sean.michael.farley at gmail.com> for tracking down the issue and
Pierre-Yves David <pierre-yves.david at ens-lyon.org> for the fix.
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -183,9 +183,10 @@ def listbookmarks(repo):
marks = getattr(repo, '_bookmarks', {})
d = {}
+ hasnode = repo.changelog.hasnode
for k, v in marks.iteritems():
# don't expose local divergent bookmarks
- if '@' not in k or k.endswith('@'):
+ if hasnode(v) and ('@' not in k or k.endswith('@')):
d[k] = hex(v)
return d
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
@@ -1386,4 +1386,10 @@ bookmarks view doesn't choke on bookmark
$ QUERY_STRING='style=raw'
$ python hgweb.cgi
+listbookmarks hides secret bookmarks
+
+ $ PATH_INFO=/; export PATH_INFO
+ $ QUERY_STRING='cmd=listkeys&namespace=bookmarks'
+ $ python hgweb.cgi
+
$ cd ..
More information about the Mercurial-devel
mailing list