hgext/evolve.py
changeset 492 7ecd41520dae
parent 491 6989d8fe4ed2
child 497 43e1b2cab789
--- a/hgext/evolve.py	Fri Aug 24 10:44:23 2012 +0200
+++ b/hgext/evolve.py	Fri Aug 24 11:17:18 2012 +0200
@@ -904,20 +904,20 @@
 
 @eh.reposetup
 def _repostabilizesetup(ui, repo):
-    """Add a hint for "hg stabilize" when troubles make push fails
+    """Add a hint for "hg evolve" when troubles make push fails
     """
     if not repo.local():
         return
 
     opush = repo.push
 
-    class stabilizerrepo(repo.__class__):
+    class evolvingrepo(repo.__class__):
         def push(self, remote, *args, **opts):
             """wrapper around pull that pull obsolete relation"""
             try:
                 result = opush(remote, *args, **opts)
             except util.Abort, ex:
-                hint = _("use 'hg stabilize' to get a stable history "
+                hint = _("use 'hg evolve' to get a stable history "
                          "or --force to ignore warnings")
                 if (len(ex.args) >= 1
                     and ex.args[0].startswith('push includes ')
@@ -925,7 +925,7 @@
                     ex.hint = hint
                 raise
             return result
-    repo.__class__ = stabilizerrepo
+    repo.__class__ = evolvingrepo
 
 @eh.wrapcommand("summary")
 def obssummary(orig, ui, repo, *args, **kwargs):
@@ -1297,21 +1297,31 @@
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 
-@command('^stabilize|evolve|solve',
+@command('^evolve|stabilize|evolve|solve',
     [('n', 'dry-run', False, 'do not perform actions, print what to be done'),
-    ('A', 'any', False, 'stabilize any unstable changeset'),
-    ('c', 'continue', False, 'continue an interrupted stabilized'), ],
+    ('A', 'any', False, 'evolve any troubled changeset'),
+    ('c', 'continue', False, 'continue an interrupted evolution'), ],
     _('[OPTIONS]...'))
-def stabilize(ui, repo, **opts):
-    """rebase an unstable changeset to make it stable again
+def evolve(ui, repo, **opts):
+    """Solve trouble in your repository
+
+    - rebase unstable changeset to make it stable again,
+    - create proper diff from latecomer changeset,
+    - merge conflicting changeset.
 
-    By default, take the first unstable changeset which could be
-    rebased as child of the working directory parent revision or one
-    of its descendants and rebase it.
+    By default, take the first troubles changeset that looks relevant.
+
+    (The logic is still a bit fuzzy)
 
-    With --any, stabilize any unstable changeset.
+    - 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.
 
-    The working directory is updated to the rebased revision.
+    - For conflicting this mean "." if applicable.
+
+    With --any, evolve pick any troubled changeset to solve
+
+    The working directory is updated to the newly created revision.
     """
 
     contopt = opts['continue']
@@ -1327,7 +1337,7 @@
     tr = _picknexttroubled(ui, repo, anyopt)
     if tr is None:
         if troubled:
-            ui.write_err(_('nothing to stabilize here\n'))
+            ui.write_err(_('nothing to evolve here\n'))
             ui.status(_('(%i troubled changesets, do you want --any ?)\n')
                       % len(troubled))
             return 2
@@ -1404,8 +1414,8 @@
             relocate(repo, orig, target)
         except MergeFailure:
             repo.opener.write('graftstate', orig.hex() + '\n')
-            repo.ui.write_err(_('stabilize failed!\n'))
-            repo.ui.write_err(_('fix conflict and run "hg stabilize --continue"\n'))
+            repo.ui.write_err(_('evolve failed!\n'))
+            repo.ui.write_err(_('fix conflict and run "hg evolve --continue"\n'))
             raise
         finally:
             lock.release()
@@ -1419,7 +1429,7 @@
     prec = repo.set('last(allprecursors(%d) and public())', latecomer).next()
     # For now we deny target merge
     if len(prec.parents()) > 1:
-        raise util.Abort('late comer stabilization is confused by precursors'
+        raise util.Abort('late comer evolution is confused by precursors'
                          ' %s being a merge' % prec)
 
     displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate})
@@ -1456,8 +1466,8 @@
                             createmarkers(repo, [(latecomer, (tmpctx,))])
                     except MergeFailure:
                         repo.opener.write('graftstate', latecomer.hex() + '\n')
-                        repo.ui.write_err(_('stabilize failed!\n'))
-                        repo.ui.write_err(_('fix conflict and run "hg stabilize --continue"\n'))
+                        repo.ui.write_err(_('evolution failed!\n'))
+                        repo.ui.write_err(_('fix conflict and run "hg evolve --continue"\n'))
                         raise
                 # Create the new commit context
                 repo.ui.status(_('computing new diff\n'))
@@ -1565,7 +1575,8 @@
                                  "or 'hg update -C .' to abandon\n"))
             #repo.dirstate.write()
             if stats[3] > 0:
-                raise util.Abort('GASP! Merge Conflict! You are on you own chap!')
+                raise util.Abort('GASP! Merge Conflict! You are on you own chap!',
+                                 hint='/!\\ hg evolve --continue will NOT work /!\\')
             tr = repo.transaction('stabilize-conflicting')
             try:
                 repo.dirstate.setparents(conflicting.node(), node.nullid)