diff hgext/evolve.py @ 1318:29363f79514f

evolve: move code to track progress and start node This makes it easier to refactor the evolve function in this serie of patches.
author Laurent Charignon <lcharignon@fb.com>
date Mon, 04 May 2015 16:09:05 -0700
parents 48f78feb0b47
children 8376fe35ebda
line wrap: on
line diff
--- a/hgext/evolve.py	Thu Apr 30 14:00:07 2015 -0700
+++ b/hgext/evolve.py	Mon May 04 16:09:05 2015 -0700
@@ -1238,11 +1238,18 @@
     contopt = opts['continue']
     anyopt = opts['any']
     allopt = opts['all']
+    startnode = repo['.']
     dryrunopt = opts['dry_run']
     confirmopt = opts['confirm']
     ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'evolve')
 
-    startnode = repo['.']
+    # Progress handling
+    seen = 1
+    count = allopt and _counttroubled(ui, repo) or 1
+
+    def progresscb():
+        if allopt:
+            ui.progress('evolve', seen, unit='changesets', total=count)
 
     if contopt:
         if anyopt:
@@ -1252,13 +1259,6 @@
         graftcmd = commands.table['graft'][0]
         return graftcmd(ui, repo, old_obsolete=True, **{'continue': True})
 
-    def progresscb():
-        if allopt:
-            ui.progress('evolve', seen, unit='changesets', total=count)
-
-    seen = 1
-    count = allopt and _counttroubled(ui, repo) or 1
-
     nexttrouble = _picknexttroubled(ui, repo, anyopt or allopt)
  
     # No trouble to resolve