Patchwork [04,of,10] bookmark: use 'divergent2delete' when updating a bookmark

login
register
mail settings
Submitter Boris Feld
Date July 15, 2017, 11:42 a.m.
Message ID <08c2a3d309e8619e0cc3.1500118972@FB>
Download mbox | patch
Permalink /patch/22397/
State Accepted
Headers show

Comments

Boris Feld - July 15, 2017, 11:42 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1499706745 -7200
#      Mon Jul 10 19:12:25 2017 +0200
# Node ID 08c2a3d309e8619e0cc3ec16c4ae02722b9a1118
# Parent  2cb988ee601bd857ed1fe29d1cc36acf1617ac5f
# EXP-Topic tr.changes.bookmarks
bookmark: use 'divergent2delete' when updating a bookmark

Patch

diff -r 2cb988ee601b -r 08c2a3d309e8 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