bookmark: use 'divergent2delete' when updating a bookmark
authorBoris Feld <boris.feld@octobus.net>
Mon, 10 Jul 2017 19:12:25 +0200
changeset 33512 1424a769f31b
parent 33511 9689239d7c2b
child 33513 904894edb205
bookmark: use 'divergent2delete' when updating a bookmark
mercurial/bookmarks.py
--- a/mercurial/bookmarks.py	Mon Jul 10 19:10:13 2017 +0200
+++ b/mercurial/bookmarks.py	Mon Jul 10 19:12:25 2017 +0200
@@ -354,7 +354,6 @@
 def update(repo, parents, node):
     deletefrom = parents
     marks = repo._bookmarks
-    update = False
     active = marks.active
     if not active:
         return False
@@ -368,12 +367,11 @@
         deletefrom = [b.node() for b in divs if b.rev() in anc or b == new]
         if validdest(repo, repo[marks[active]], new):
             bmchanges.append((active, new.node()))
-            update = True
 
-    if deletedivergent(repo, deletefrom, active):
-        update = True
+    for bm in divergent2delete(repo, deletefrom, active):
+        bmchanges.append((bm, None))
 
-    if update:
+    if bmchanges:
         lock = tr = None
         try:
             lock = repo.lock()
@@ -382,7 +380,7 @@
             tr.close()
         finally:
             lockmod.release(tr, lock)
-    return update
+    return bool(bmchanges)
 
 def listbinbookmarks(repo):
     # We may try to list bookmarks on a repo type that does not