stabilize: handle killed changeset in stabilize.
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 20 Aug 2012 14:40:48 +0200
changeset 466 b98490b689a5
parent 465 4a039a8c1cf3
child 467 869ddfb98c7e
stabilize: handle killed changeset in stabilize.
hgext/evolve.py
tests/test-tutorial.t
--- 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
   |