hgext/evolve.py
changeset 704 2ec7c3673679
parent 703 a246b02499d9
child 706 90f0a1ede70a
--- a/hgext/evolve.py	Sat Feb 09 15:42:14 2013 +0100
+++ b/hgext/evolve.py	Sat Feb 09 16:21:22 2013 +0100
@@ -858,6 +858,7 @@
 @command('^evolve|stabilize|evolve|solve',
     [('n', 'dry-run', False, 'do not perform actions, print what to be done'),
     ('A', 'any', False, 'evolve any troubled changeset'),
+    ('a', 'all', False, 'evolve all troubled changesets'),
     ('c', 'continue', False, 'continue an interrupted evolution'), ],
     _('[OPTIONS]...'))
 def evolve(ui, repo, **opts):
@@ -884,15 +885,29 @@
 
     contopt = opts['continue']
     anyopt = opts['any']
+    allopt = opts['all']
     dryrunopt = opts['dry_run']
 
+    evolved_changesets = 0
+
     if contopt:
         if anyopt:
             raise util.Abort('can not specify both "--any" and "--continue"')
+        if allopt:
+            raise util.Abort('can not specify both "--all" and "--continue"')
         graftcmd = commands.table['graft'][0]
         return graftcmd(ui, repo, old_obsolete=True, **{'continue': True})
-
-    return _evolveany(ui, repo, anyopt, dryrunopt)
+    while True:
+        result = _evolveany(ui, repo, anyopt or allopt, dryrunopt)
+        if(1 == result):
+            if(0 < evolved_changesets):
+                # We evolved some changesets, and now we're done
+                return 0
+            ui.write_err(_('no troubled changeset\n')) 
+        if not allopt:
+            return result
+        evolved_changesets+=1
+        
 
 def _evolveany(ui, repo, anyopt, dryrunopt):
     tr = _picknexttroubled(ui, repo, anyopt)
@@ -904,7 +919,6 @@
                       % len(troubled))
             return 2
         else:
-            ui.write_err(_('no troubled changeset\n'))
             return 1
     repo = repo.unfiltered()
     tr = repo[tr.rev()]