# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1521195965 -19800 # Node ID 60e132e20b14f6875a22d598a1013f2f9251173d # Parent f045fafd3484feb25c6b301e065f81042ea83df4 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. diff -r f045fafd3484 -r 60e132e20b14 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`"""