1. Pierre-Yves David
  2. mutable-history

Commits

Dan Villiom Podlaski Christiansen  committed 3291514

prune: update to successor rather than parent when prune '.'

  • Participants
  • Parent commits cac35be
  • Branches stable

Comments (0)

Files changed (3)

File README

View file
  • Ignore whitespace
 - 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
 

File hgext/evolve.py

View file
  • Ignore whitespace
 
         # 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)

File tests/test-prune.t

View file
  • Ignore whitespace
 
 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)
   $ hg id -ir 6:2702dd0c91e7
   abort: unknown revision '2702dd0c91e7'!
   [255]
-