changeset 44371:0275000564c4

bookmarks: refactor in preparation for next commit Differential Revision: https://phab.mercurial-scm.org/D8116
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Thu, 13 Feb 2020 22:06:57 -0500
parents edaae3616ba3
children 8407031f195f
files mercurial/bookmarks.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Sat Feb 15 14:51:33 2020 -0500
+++ b/mercurial/bookmarks.py	Thu Feb 13 22:06:57 2020 -0500
@@ -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