Mercurial > hg
changeset 30481:0a3b11a7489a
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.
author | Stanislau Hlebik <stash@fb.com> |
---|---|
date | Thu, 17 Nov 2016 00:59:41 -0800 |
parents | b0a8337ba9af |
children | 55ec13c82ea0 |
files | mercurial/bookmarks.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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).