changeset 33512:1424a769f31b

bookmark: use 'divergent2delete' when updating a bookmark
author Boris Feld <boris.feld@octobus.net>
date Mon, 10 Jul 2017 19:12:25 +0200
parents 9689239d7c2b
children 904894edb205
files mercurial/bookmarks.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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