Commits

Pierre-Yves David committed 79a1d28 Merge

merge --all option from tak

  • Participants
  • Parent commits 60582b8, 0ff2251

Comments (0)

Files changed (2)

 @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):
 
     - 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:
                       % 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
 
         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})

tests/test-evolve.t

   +deux
   $ hg log -r 'bumped()' # no more bumped
 
+test evolve --all
+  $ sed -i'' -e s/deux/to/ main-file-1
+  $ hg commit -m 'dansk 2!'
+  $ sed -i'' -e s/Three/tre/ main-file-1
+  $ hg commit -m 'dansk 3!'
+  $ hg update 9
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ sed -i'' -e s/Un/Én/ main-file-1
+  $ hg commit --amend -m 'dansk!'
+  2 new unstable changesets
+
+  $ hg evolve --all --traceback
+  move:[10] dansk 2!
+  atop:[13] dansk!
+  merging main-file-1
+  move:[11] dansk 3!
+  atop:[14] dansk 2!
+  merging main-file-1
+  $ hg glog
+  @  15	: dansk 3! - test
+  |
+  o  14	: dansk 2! - test
+  |
+  o  13	feature-B: dansk! - test
+  |
+  o  7	: another feature - test
+  |
+  o  6	feature-A: a nifty feature - test
+  |
+  o  0	: base - test
+  
+
   $ cd ..
 
 enable general delta