# HG changeset patch # User Laurent Charignon # Date 1430861135 25200 # Node ID 739208d1ee62b960a1851bf8b6295013ff9d3421 # Parent 603104c880f7d1434e74d467db246024ba7f7b58 evolve: extract cleanup logic in the evolve function We are going to need to reuse the cleanup logic when introducing --rev, so we extract it in a method to avoid code duplication. diff -r 603104c880f7 -r 739208d1ee62 hgext/evolve.py --- a/hgext/evolve.py Thu Apr 30 14:25:37 2015 -0700 +++ b/hgext/evolve.py Tue May 05 14:25:35 2015 -0700 @@ -1215,6 +1215,14 @@ else: ui.write_err(_('no troubled changesets\n')) return 1 + +def _cleanup(ui, repo, startnode, showprogress): + if showprogress: + ui.progress('evolve', None) + if repo['.'] != startnode: + ui.status(_('working directory is now at %s\n') % repo['.']) + + @command('^evolve|stabilize|solve', [('n', 'dry-run', False, 'do not perform actions, just print what would be done'), @@ -1296,12 +1304,7 @@ # Resolving a single trouble _solveone(ui, repo, nexttrouble, dryrunopt, confirmopt, progresscb) - # Cleanup - if showprogress: - ui.progress('evolve', None) - - if repo['.'] != startnode: - ui.status(_('working directory is now at %s\n') % repo['.']) + _cleanup(ui, repo, startnode, showprogress) def _evolveany(ui, repo, tro, dryrunopt, confirmopt, progresscb):