[PATCH 02 of 10 V9] bookmarks: use listbinbookmarks() in listbookmarks()

Stanislau Hlebik stash at fb.com
Sun Nov 13 05:30:13 EST 2016


# HG changeset patch
# User Stanislau Hlebik <stash at fb.com>
# Date 1479032114 28800
#      Sun Nov 13 02:15:14 2016 -0800
# Branch stable
# Node ID 031419529f6594c3f23fc179d67c8de9ef63472f
# Parent  ffa31155703b725b20d67f379bea4de7c56379fe
bookmarks: use listbinbookmarks() in listbookmarks()

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -296,16 +296,9 @@
             yield k, v
 
 def listbookmarks(repo):
-    # We may try to list bookmarks on a repo type that does not
-    # support it (e.g., statichttprepository).
-    marks = getattr(repo, '_bookmarks', {})
-
     d = {}
-    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('@')):
-            d[k] = hex(v)
+    for book, node in listbinbookmarks(repo):
+        d[book] = hex(node)
     return d
 
 def pushbookmark(repo, key, old, new):


More information about the Mercurial-devel mailing list