changeset 466:b98490b689a5

stabilize: handle killed changeset in stabilize.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 20 Aug 2012 14:40:48 +0200
parents 4a039a8c1cf3
children 869ddfb98c7e
files hgext/evolve.py tests/test-tutorial.t
diffstat 2 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/evolve.py	Mon Aug 20 14:13:29 2012 +0200
+++ b/hgext/evolve.py	Mon Aug 20 14:40:48 2012 +0200
@@ -272,13 +272,17 @@
         obs = orig.parents()[1]
     assert obs.obsolete()
     newer = obsolete.newerversion(repo, obs.node())
+    # search of a parent which is not killed
+    while newer == [()]:
+        ui.debug("stabilize target %s is plain dead,"
+                 " trying to stabilize on it's parent")
+        obs = obs.parents()[0]
+        newer = obsolete.newerversion(repo, obs.node())
     if len(newer) > 1:
         ui.write_err(_("conflict rewriting. can't choose destination\n"))
         return 2
     targets = newer[0]
-    if not targets:
-        ui.write_err(_("does not handle kill parent yet\n"))
-        return 2
+    assert targets
     if len(targets) > 1:
         ui.write_err(_("does not handle splitted parent yet\n"))
         return 2
--- a/tests/test-tutorial.t	Mon Aug 20 14:13:29 2012 +0200
+++ b/tests/test-tutorial.t	Mon Aug 20 14:40:48 2012 +0200
@@ -741,16 +741,13 @@
   $ hg log -r 'unstable()'
   ae45c0c3092a (draft): SPAM SPAM SPAM
 
-# XXX make prune stabilization works
-#  $ hg stabilize --any
-#  merging shopping
-
-  $ hg graft -O ae45c0c3092a
-  grafting revision 17
+  $ hg stabilize --any
+  move:[17] SPAM SPAM SPAM
+  atop:[14] bathroom stuff
   merging shopping
 
   $ hg log -G
-  @  20de1fb1cec5 (draft): SPAM SPAM SPAM
+  @  d6717f710962 (draft): SPAM SPAM SPAM
   |
   o  ffa278c50818 (draft): bathroom stuff
   |