Patchwork [2,of,7,evolve-ext] _finalizerelocate

login
register
mail settings
Submitter Shusen LIU
Date Dec. 7, 2015, 1:46 a.m.
Message ID <4b328ecda544c3b06587.1449452807@dev1221.lla1.facebook.com>
Download mbox | patch
Permalink /patch/11879/
State Rejected, archived
Delegated to: Laurent Charignon
Headers show

Comments

Shusen LIU - Dec. 7, 2015, 1:46 a.m.
# HG changeset patch
# User Shusen LIU <liushusen@fb.com>
# Date 1449450646 28800
#      Sun Dec 06 17:10:46 2015 -0800
# Node ID 4b328ecda544c3b06587ea6825031fcd8c960932
# Parent  3021c118e9b77a0332cbda182fa27277b9011c04
_finalizerelocate

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -965,21 +965,7 @@ 
                 pass
             exc.__class__ = LocalMergeFailure
             raise
-        oldbookmarks = repo.nodebookmarks(nodesrc)
-        if nodenew is not None:
-            phases.retractboundary(repo, tr, destphase, [nodenew])
-            obsolete.createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))])
-            for book in oldbookmarks:
-                repo._bookmarks[book] = nodenew
-        else:
-            obsolete.createmarkers(repo, [(repo[nodesrc], ())])
-            # Behave like rebase, move bookmarks to dest
-            for book in oldbookmarks:
-                repo._bookmarks[book] = dest.node()
-        for book in destbookmarks: # restore bookmark that rebase move
-            repo._bookmarks[book] = dest.node()
-        if oldbookmarks or destbookmarks:
-            repo._bookmarks.recordchange(tr)
+        _finalizerelocate(repo, orig, dest, nodenew, tr)
         tr.close()
     finally:
         tr.release()
@@ -3668,3 +3654,23 @@ 
     finally:
         repo.ui.restoreconfig(backup)
     return nodenew
+
+def _finalizerelocate(repo, orig, dest, nodenew, tr):
+    destbookmarks = repo.nodebookmarks(dest.node())
+    nodesrc = orig.node()
+    destphase = repo[nodesrc].phase()
+    oldbookmarks = repo.nodebookmarks(nodesrc)
+    if nodenew is not None:
+        phases.retractboundary(repo, tr, destphase, [nodenew])
+        obsolete.createmarkers(repo, [(repo[nodesrc], (repo[nodenew],))])
+        for book in oldbookmarks:
+            repo._bookmarks[book] = nodenew
+    else:
+        obsolete.createmarkers(repo, [(repo[nodesrc], ())])
+        # Behave like rebase, move bookmarks to dest
+        for book in oldbookmarks:
+            repo._bookmarks[book] = dest.node()
+    for book in destbookmarks: # restore bookmark that rebase move
+        repo._bookmarks[book] = dest.node()
+    if oldbookmarks or destbookmarks:
+        repo._bookmarks.recordchange(tr)