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

login
register
mail settings
Submitter Stanislau Hlebik
Date Nov. 20, 2016, 12:13 p.m.
Message ID <54b24eb2eac7c181f9fd.1479644035@dev1918.lla1.facebook.com>
Download mbox | patch
Permalink /patch/17643/
State Accepted
Headers show

Comments

Stanislau Hlebik - Nov. 20, 2016, 12:13 p.m.
# HG changeset patch
# User Stanislau Hlebik <stash@fb.com>
# Date 1479373181 28800
#      Thu Nov 17 00:59:41 2016 -0800
# Node ID 54b24eb2eac7c181f9fd15423fd05218a6a11186
# Parent  a3159f73e59868f8ae0993cc91277142aaa10536
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):