changeset 1324:739208d1ee62

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.
author Laurent Charignon <lcharignon@fb.com>
date Tue, 05 May 2015 14:25:35 -0700
parents 603104c880f7
children 1fe3da0b4601
files hgext/evolve.py
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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):