evolve: pass the instability category to relocate() and _finalizerelocate()
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 28 Mar 2018 13:48:34 +0530
changeset 3635 debd2f974be5
parent 3634 a9fed41c6bed
child 3636 92a2d3217de9
evolve: pass the instability category to relocate() and _finalizerelocate() This patch adds category argument to relocate() and _finalizerelocate() functions to take the type of instability which we are processing so that we perform actions accordingly.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Wed Mar 28 12:56:35 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Mar 28 13:48:34 2018 +0530
@@ -168,7 +168,7 @@
         if progresscb:
             progresscb()
         try:
-            newid = relocate(repo, orig, target, pctx, keepbranch)
+            newid = relocate(repo, orig, target, pctx, keepbranch, 'orphan')
             return (True, newid)
         except MergeFailure:
             ops = {'current': orig.node()}
@@ -236,7 +236,7 @@
         repo.ui.status(
             _('rebasing to destination parent: %s\n') % prec.p1())
         try:
-            tmpid = relocate(repo, bumped, prec.p1())
+            tmpid = relocate(repo, bumped, prec.p1(), category='phasedivergent')
             if tmpid is not None:
                 tmpctx = repo[tmpid]
                 compat.createmarkers(repo, [(bumped, (tmpctx,))],
@@ -479,7 +479,7 @@
     ordering.extend(sorted(dependencies))
     return ordering
 
-def relocate(repo, orig, dest, pctx=None, keepbranch=False):
+def relocate(repo, orig, dest, pctx=None, keepbranch=False, category=None):
     """rewrites the orig rev on dest rev
 
     returns the node of new commit which is formed
@@ -544,7 +544,7 @@
         exc.__class__ = LocalMergeFailure
         tr.close() # to keep changes in this transaction (e.g. dirstate)
         raise
-    _finalizerelocate(repo, orig, dest, nodenew, tr)
+    _finalizerelocate(repo, orig, dest, nodenew, tr, category)
     return nodenew
 
 def _relocatecommit(repo, orig, commitmsg):
@@ -566,7 +566,7 @@
         repo.ui.restoreconfig(backup)
     return nodenew
 
-def _finalizerelocate(repo, orig, dest, nodenew, tr):
+def _finalizerelocate(repo, orig, dest, nodenew, tr, category):
     destbookmarks = repo.nodebookmarks(dest.node())
     nodesrc = orig.node()
     oldbookmarks = repo.nodebookmarks(nodesrc)