# HG changeset patch # User Stanislau Hlebik # Date 2016-11-17 08:59:41 # Node ID 0a3b11a7489a688a055cfbab531ee65f6a57a4f1 # Parent b0a8337ba9aff1039162815af550ea46605ef457 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. diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -284,6 +284,17 @@ def update(repo, parents, node): 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).