prune: update to successor rather than parent when prune '.' stable
authorDan Villiom Podlaski Christiansen <dan@cabo.dk>
Thu, 09 Jan 2014 11:33:15 +0100
branchstable
changeset 931 32915143d448
parent 930 cac35bef8aee
child 932 bcd0c12070b2
child 933 e5baeb8fefec
prune: update to successor rather than parent when prune '.'
README
hgext/evolve.py
tests/test-prune.t
--- a/README	Fri May 09 03:06:36 2014 -0700
+++ b/README	Thu Jan 09 11:33:15 2014 +0100
@@ -52,6 +52,7 @@
 - fix a bug where evolve were creating changeset with 2 parents on windows
   (fix issues #16, #35 and #42)
 - adds a --obsolete flag to import (requieres Mercurial 3.0)
+- prune: update to successor rather than parent when pruning '.' with -s
 
 3.3.1 -- 2014-04-23
 
--- a/hgext/evolve.py	Fri May 09 03:06:36 2014 -0700
+++ b/hgext/evolve.py	Thu Jan 09 11:33:15 2014 +0100
@@ -1487,11 +1487,19 @@
 
         # informs that changeset have been pruned
         ui.status(_('%i changesets pruned\n') % len(precs))
-        # update to an unkilled parent
+
         wdp = repo['.']
-        newnode = wdp
-        while newnode.obsolete():
-            newnode = newnode.parents()[0]
+
+        if len(sucs) == 1 and len(precs) == 1 and wdp in precs:
+            # '.' killed, so update to the successor
+            newnode = sucs[0]
+        else:
+            # update to an unkilled parent
+            newnode = wdp
+
+            while newnode.obsolete():
+                newnode = newnode.parents()[0]
+
         if newnode.node() != wdp.node():
             commands.update(ui, repo, newnode.rev())
             ui.status(_('working directory now at %s\n') % newnode)
--- a/tests/test-prune.t	Fri May 09 03:06:36 2014 -0700
+++ b/tests/test-prune.t	Thu Jan 09 11:33:15 2014 +0100
@@ -115,8 +115,12 @@
 
 one old, one new
 
+  $ hg up 'desc("add ee")'
+  4 files updated, 0 files merged, 4 files removed, 0 files unresolved
   $ hg prune 'desc("add ee")' -s 'desc("add nE")'
   1 changesets pruned
+  4 files updated, 0 files merged, 4 files removed, 0 files unresolved
+  working directory now at 6e8148413dd5
   $ hg debugobsolete
   9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '314064000 0', 'user': 'blah'} (glob)
   7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
@@ -257,4 +261,3 @@
   $ hg id -ir 6:2702dd0c91e7
   abort: unknown revision '2702dd0c91e7'!
   [255]
-