D8116: bookmarks: refactor in preparation for next commit

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Fri Feb 21 09:55:56 UTC 2020


Closed by commit rHG0275000564c4: bookmarks: refactor in preparation for next commit (authored by valentin.gatienbaron).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D8116?vs=20210&id=20271#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8116?vs=20210&id=20271

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8116/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8116

AFFECTED FILES
  mercurial/bookmarks.py

CHANGE DETAILS

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -463,6 +463,10 @@
     return bool(bmchanges)
 
 
+def isdivergent(b):
+    return b'@' in b and not b.endswith(b'@')
+
+
 def listbinbookmarks(repo):
     # We may try to list bookmarks on a repo type that does not
     # support it (e.g., statichttprepository).
@@ -471,7 +475,7 @@
     hasnode = repo.changelog.hasnode
     for k, v in pycompat.iteritems(marks):
         # don't expose local divergent bookmarks
-        if hasnode(v) and (b'@' not in k or k.endswith(b'@')):
+        if hasnode(v) and not isdivergent(k):
             yield k, v
 
 



To: valentin.gatienbaron, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list