evolve: move logic to continue interrupted content-div resolution to new fn
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 10 Jun 2018 20:35:48 +0530
changeset 3822 cb060c408b41
parent 3821 f67ac33c07d2
child 3823 7b33a6ed0539
evolve: move logic to continue interrupted content-div resolution to new fn Each of the other type has defined their own function to continue/complete the interrupted resolution. We take out the logic for content-div resolution too in a separate function to make the top level function looks clean.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Mon Jun 11 01:12:12 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Jun 10 20:35:48 2018 +0530
@@ -1547,22 +1547,7 @@
         elif evolvestate['category'] == 'phasedivergent':
             _completephasedivergent(ui, repo, evolvestate)
         elif evolvestate['category'] == 'contentdivergent':
-            tr = None
-            try:
-                tr = repo.transaction('evolve')
-                divergent = evolvestate['divergent']
-                other = evolvestate['other-divergent']
-                base = evolvestate['base']
-                repo = repo.unfiltered()
-                ret = _completecontentdivergent(ui, repo, progresscb,
-                                                repo[divergent],
-                                                repo[other],
-                                                repo[base],
-                                                evolvestate)
-                evolvestate['replacements'][divergent] = ret[1]
-                tr.close()
-            finally:
-                tr.release()
+            _continuecontentdivergent(ui, repo, evolvestate, progresscb)
         else:
             repo.ui.status(_("continuing interrupted '%s' resolution is not yet"
                              " supported\n") % evolvestate['category'])
@@ -1586,6 +1571,25 @@
                         evolvestate['skippedrevs'].append(curctx.node())
         return
 
+def _continuecontentdivergent(ui, repo, evolvestate, progresscb):
+    """function to continue the interrupted content-divergence resolution."""
+    tr = None
+    try:
+        tr = repo.transaction('evolve')
+        divergent = evolvestate['divergent']
+        other = evolvestate['other-divergent']
+        base = evolvestate['base']
+        repo = repo.unfiltered()
+        ret = _completecontentdivergent(ui, repo, progresscb,
+                                        repo[divergent],
+                                        repo[other],
+                                        repo[base],
+                                        evolvestate)
+        evolvestate['replacements'][divergent] = ret[1]
+        tr.close()
+    finally:
+        tr.release()
+
 def _completephasedivergent(ui, repo, evolvestate):
     """function to complete the interrupted phase-divergence resolution.