changeset 3822:cb060c408b41

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.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 10 Jun 2018 20:35:48 +0530
parents f67ac33c07d2
children 7b33a6ed0539
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 20 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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.