evolve: de-duplicate some function calls
_cleanup() was called in continueevolve() and evolve() function too. Let's call
it at a single place for both the cases. Also call progresscb() outside of
conditionals to call it both times.
--- a/hgext3rd/evolve/evolvecmd.py Fri Mar 16 16:11:22 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py Fri Mar 16 17:00:01 2018 +0530
@@ -1130,6 +1130,10 @@
raise error.Abort('no evolve to continue')
evolvestate.load()
continueevolve(ui, repo, evolvestate, progresscb)
+ if evolvestate['command'] != 'evolve':
+ evolvestate.delete()
+ return
+ startnode = repo.unfiltered()[evolvestate['startnode']]
evolvestate.delete()
else:
cmdutil.bailifchanged(repo)
@@ -1160,8 +1164,8 @@
evolvestate['replacements'][curctx.node()] = [ret[1]]
else:
evolvestate['skippedrevs'].append(curctx.node())
- progresscb()
- _cleanup(ui, repo, startnode, showprogress)
+ progresscb()
+ _cleanup(ui, repo, startnode, showprogress)
def continueevolve(ui, repo, evolvestate, progresscb):
"""logic for handling of `hg evolve --continue`"""
@@ -1227,7 +1231,6 @@
evolvestate['replacements'][ctx.node()] = node
category = evolvestate['category']
confirm = evolvestate['confirm']
- startnode = evolvestate['startnode']
unfi = repo.unfiltered()
for rev in evolvestate['revs']:
# XXX: prevent this lookup by storing nodes instead of revnums
@@ -1240,6 +1243,4 @@
evolvestate['replacements'][curctx.node()] = newnode[1]
else:
evolvestate['skippedrevs'].append(curctx.node())
-
- _cleanup(ui, repo, unfi[startnode], True)
return