hgext/evolve.py
changeset 1171 d14537d7dca9
parent 1170 4697f23e0ede
parent 1168 2187f7c88ff6
child 1172 8d28bb4fc127
--- a/hgext/evolve.py	Thu Nov 20 15:33:59 2014 -0800
+++ b/hgext/evolve.py	Thu Nov 20 15:34:34 2014 -0800
@@ -19,7 +19,7 @@
     - improves some aspect of the early implementation in Mercurial core
 '''
 
-__version__ = '5.1.0'
+__version__ = '5.0.0'
 testedwith = '3.2'
 buglink = 'http://bz.selenic.com/'
 
@@ -884,7 +884,7 @@
 def _installimportobsolete(ui):
     entry = cmdutil.findcmd('import', commands.table)[1]
     entry[1].append(('', 'obsolete', False,
-                    _('mark the old node as obsoleted by'
+                    _('mark the old node as obsoleted by '
                       'the created commit')))
 
 @eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
@@ -1118,7 +1118,7 @@
     ] + mergetoolopts,
     _('[OPTIONS]...'))
 def evolve(ui, repo, **opts):
-    """Solve trouble in your repository
+    """solve trouble in your repository
 
     - rebase unstable changesets to make them stable again,
     - create proper diffs from bumped changesets,
@@ -1584,9 +1584,10 @@
 shorttemplate = '[{rev}] {desc|firstline}\n'
 
 @command('^previous',
-         [],
-         '')
-def cmdprevious(ui, repo):
+         [('B', 'move-bookmark', False,
+             _('Move current active bookmark after update'))],
+         '[-B]')
+def cmdprevious(ui, repo, **opts):
     """update to parent and display summary lines"""
     wkctx = repo[None]
     wparents = wkctx.parents()
@@ -1598,11 +1599,14 @@
     if len(parents) == 1:
         p = parents[0]
         bm = bookmarks.readcurrent(repo)
-        shouldmove = bm is not None and bookmarks.iscurrent(repo, bm)
+        shouldmove = opts.get('move_bookmark') and bm is not None
         ret = hg.update(repo, p.rev())
-        if not ret and shouldmove:
-            repo._bookmarks[bm] = p.node()
-            repo._bookmarks.write()
+        if not ret:
+            if shouldmove:
+                repo._bookmarks[bm] = p.node()
+                repo._bookmarks.write()
+            else:
+                bookmarks.unsetcurrent(repo)
         displayer.show(p)
         return 0
     else:
@@ -1612,9 +1616,10 @@
         return 1
 
 @command('^next',
-         [],
-         '')
-def cmdnext(ui, repo):
+         [('B', 'move-bookmark', False,
+             _('Move current active bookmark after update'))],
+         '[-B]')
+def cmdnext(ui, repo, **opts):
     """update to child and display summary lines"""
     wkctx = repo[None]
     wparents = wkctx.parents()
@@ -1629,11 +1634,14 @@
     if len(children) == 1:
         c = children[0]
         bm = bookmarks.readcurrent(repo)
-        shouldmove = bm is not None and bookmarks.iscurrent(repo, bm)
+        shouldmove = opts.get('move_bookmark') and bm is not None
         ret = hg.update(repo, c.rev())
-        if not ret and shouldmove:
-            repo._bookmarks[bm] = c.node()
-            repo._bookmarks.write()
+        if not ret:
+            if shouldmove:
+                repo._bookmarks[bm] = c.node()
+                repo._bookmarks.write()
+            else:
+                bookmarks.unsetcurrent(repo)
         displayer.show(c)
         return 0
     else:
@@ -2054,7 +2062,7 @@
     # allow to choose the seed ?
     _('[-r] revs'))
 def touch(ui, repo, *revs, **opts):
-    """Create successors that are identical to their predecessors except for the changeset ID
+    """create successors that are identical to their predecessors except for the changeset ID
 
     This is used to "resurrect" changesets
     """