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

login
register
mail settings
Submitter Stanislau Hlebik
Date Nov. 13, 2016, 10:30 a.m.
Message ID <031419529f6594c3f23f.1479033013@dev1918.lla1.facebook.com>
Download mbox | patch
Permalink /patch/17534/
State Changes Requested
Headers show

Comments

Stanislau Hlebik - Nov. 13, 2016, 10:30 a.m.
# HG changeset patch
# User Stanislau Hlebik <stash@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()

Patch

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):