TakUnity avatar TakUnity committed 2ec7c36

evolve: add --all argument.

Comments (0)

Files changed (1)

     [('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'), ],
 def evolve(ui, repo, **opts):
     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)
                       % len(troubled))
             return 2
-            ui.write_err(_('no troubled changeset\n'))
             return 1
     repo = repo.unfiltered()
     tr = repo[tr.rev()]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.