bookmarks: introduce listbinbookmarks()
`bookmarks` bundle2 part will work with binary nodes. To avoid unnecessary
conversions between binary and hex nodes let's add `listbinbookmarks()` that
returns binary nodes. For now this function is a copy-paste of
listbookmarks(). In the next patch this copy-paste will be removed.
--- a/mercurial/bookmarks.py Mon Nov 21 16:22:26 2016 -0800
+++ b/mercurial/bookmarks.py Thu Nov 17 00:59:41 2016 -0800
@@ -284,6 +284,17 @@
lockmod.release(tr, lock)
return update
+def listbinbookmarks(repo):
+ # We may try to list bookmarks on a repo type that does not
+ # support it (e.g., statichttprepository).
+ marks = getattr(repo, '_bookmarks', {})
+
+ hasnode = repo.changelog.hasnode
+ for k, v in marks.iteritems():
+ # don't expose local divergent bookmarks
+ if hasnode(v) and ('@' not in k or k.endswith('@')):
+ yield k, v
+
def listbookmarks(repo):
# We may try to list bookmarks on a repo type that does not
# support it (e.g., statichttprepository).