hgext/evolve.py
branchstable
changeset 710 79a1d2816bdb
parent 702 b5a85a8909d3
parent 708 0ff2251adfe0
child 714 3867f7b1fe6e
--- a/hgext/evolve.py	Sat Feb 09 20:52:30 2013 +0000
+++ b/hgext/evolve.py	Sat Feb 09 20:53:03 2013 +0000
@@ -833,6 +833,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):
@@ -840,33 +841,37 @@
 
     - rebase unstable changeset to make it stable again,
     - create proper diff from bumped changeset,
-    - merge divergent changeset.
+    - merge divergent changesets.
 
-    By default, take the first troubles changeset that looks relevant.
+    By default, take the first trouble changeset that looks relevant.
 
     (The logic is still a bit fuzzy)
 
-    - For unstable, that mean the first which could be rebased as child of the
-      working directory parent revision or one of its descendants and rebase
-      it.
+    - For unstable, this means taking the first which could be rebased as a
+      child of the working directory parent revision or one of its descendants
+      and rebasing it.
 
-    - For divergent this mean "." if applicable.
+    - For divergent, this means taking "." if applicable.
 
-    With --any, evolve pick any troubled changeset to solve
+    With --any, evolve picks any troubled changeset to solve.
 
     The working directory is updated to the newly created revision.
     """
 
     contopt = opts['continue']
     anyopt = opts['any']
+    allopt = opts['all']
+    dryrunopt = opts['dry_run']
 
     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})
 
-    tr = _picknexttroubled(ui, repo, anyopt)
+    tr = _picknexttroubled(ui, repo, anyopt or allopt)
     if tr is None:
         troubled = repo.revs('troubled()')
         if troubled:
@@ -875,20 +880,29 @@
                       % len(troubled))
             return 2
         else:
-            ui.write_err(_('no troubled changeset\n'))
+            ui.write_err(_('no troubled changesets\n')) 
             return 1
+
+    while tr is not None:
+        result = _evolveany(ui, repo, tr, dryrunopt)
+        if not allopt:
+            return result
+        tr = _picknexttroubled(ui, repo, anyopt or allopt)
+        
+
+def _evolveany(ui, repo, tr, dryrunopt):
     repo = repo.unfiltered()
     tr = repo[tr.rev()]
     cmdutil.bailifchanged(repo)
     troubles = tr.troubles()
     if 'unstable' in troubles:
-        return _solveunstable(ui, repo, tr, opts['dry_run'])
+        return _solveunstable(ui, repo, tr, dryrunopt)
     elif 'bumped' in troubles:
-        return _solvebumped(ui, repo, tr, opts['dry_run'])
+        return _solvebumped(ui, repo, tr, dryrunopt)
     elif 'divergent' in troubles:
         repo = repo.unfiltered()
         tr = repo[tr.rev()]
-        return _solvedivergent(ui, repo, tr, opts['dry_run'])
+        return _solvedivergent(ui, repo, tr, dryrunopt)
     else:
         assert False  # WHAT? unknown troubles
 
@@ -948,12 +962,11 @@
         obs = obs.parents()[0]
         newer = obsolete.successorssets(repo, obs.node())
     if len(newer) > 1:
-        ui.write_err(_("conflict rewriting. can't choose destination\n"))
-        return 2
+        raise util.Abort(_("conflict rewriting. can't choose destination\n"))
     targets = newer[0]
     assert targets
     if len(targets) > 1:
-        ui.write_err(_("does not handle splitted parent yet\n"))
+        raise util.Abort(_("does not handle split parents yet\n"))
         return 2
     target = targets[0]
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})