[PATCH 3 of 4 evolve-ext] evolve: move code to track progress and start node

Laurent Charignon lcharignon at fb.com
Tue May 5 12:30:46 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1430780945 25200
#      Mon May 04 16:09:05 2015 -0700
# Node ID 29363f79514fc2f2deeb2c91099412aaf49a5d82
# Parent  48f78feb0b47b6a9725bbe6b28503b3f65c0cebf
evolve: move code to track progress and start node

This makes it easier to refactor the evolve function in this serie of patches.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -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


More information about the Mercurial-devel mailing list