evolve: move the handling for non-continue part in else conditional
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 16 Mar 2018 15:56:05 +0530
changeset 3555 60e132e20b14
parent 3554 f045fafd3484
child 3556 b0438c9101ad
evolve: move the handling for non-continue part in else conditional This will help us do factor out which operations we want to do for continue, which for non-continue and which operations we want to do for both of them.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Wed Mar 14 21:21:10 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Mar 16 15:56:05 2018 +0530
@@ -1128,36 +1128,37 @@
     if contopt:
         return continueevolve(ui, repo, evolvestate, progresscb)
 
-    cmdutil.bailifchanged(repo)
+    else:
+        cmdutil.bailifchanged(repo)
 
-    revs = _selectrevs(repo, allopt, revopt, anyopt, targetcat)
+        revs = _selectrevs(repo, allopt, revopt, anyopt, targetcat)
 
-    if not revs:
-        return _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat)
+        if not revs:
+            return _handlenotrouble(ui, repo, allopt, revopt, anyopt, targetcat)
 
-    # For the progress bar to show
-    count = len(revs)
-    # Order the revisions
-    if targetcat == 'orphan':
-        revs = _orderrevs(repo, revs)
+        # For the progress bar to show
+        count = len(revs)
+        # Order the revisions
+        if targetcat == 'orphan':
+            revs = _orderrevs(repo, revs)
 
-    # cbor does not know how to serialize sets, using list for skippedrevs
-    stateopts = {'category': targetcat, 'replacements': {}, 'revs': revs,
-                 'confirm': confirmopt, 'startnode': startnode.node(),
-                 'skippedrevs': [], 'command': 'evolve'}
-    evolvestate.addopts(stateopts)
-    for rev in revs:
-        curctx = repo[rev]
+        # cbor does not know how to serialize sets, using list for skippedrevs
+        stateopts = {'category': targetcat, 'replacements': {}, 'revs': revs,
+                     'confirm': confirmopt, 'startnode': startnode.node(),
+                     'skippedrevs': [], 'command': 'evolve'}
+        evolvestate.addopts(stateopts)
+        for rev in revs:
+            curctx = repo[rev]
+            progresscb()
+            ret = _solveone(ui, repo, curctx, evolvestate, dryrunopt, confirmopt,
+                            progresscb, targetcat)
+            seen += 1
+            if ret[0]:
+                evolvestate['replacements'][curctx.node()] = [ret[1]]
+            else:
+                evolvestate['skippedrevs'].append(curctx.node())
         progresscb()
-        ret = _solveone(ui, repo, curctx, evolvestate, dryrunopt, confirmopt,
-                        progresscb, targetcat)
-        seen += 1
-        if ret[0]:
-            evolvestate['replacements'][curctx.node()] = [ret[1]]
-        else:
-            evolvestate['skippedrevs'].append(curctx.node())
-    progresscb()
-    _cleanup(ui, repo, startnode, showprogress)
+        _cleanup(ui, repo, startnode, showprogress)
 
 def continueevolve(ui, repo, evolvestate, progresscb):
     """logic for handling of `hg evolve --continue`"""