evolve: update the pre-check message for risk of orphans draft
authorSushil khanchi <sushilkhanchi97@gmail.com>
Sat, 14 Dec 2019 13:31:45 +0530
changeset 5234 ea3f9e171b9a
parent 5233 efd1aa8c313c
child 5235 a1cf66165e69
evolve: update the pre-check message for risk of orphans
hgext3rd/evolve/rewriteutil.py
tests/test-evolve.t
tests/test-fold.t
tests/test-metaedit.t
tests/test-split.t
--- a/hgext3rd/evolve/rewriteutil.py	Sun Nov 10 16:32:34 2019 +0530
+++ b/hgext3rd/evolve/rewriteutil.py	Sat Dec 14 13:31:45 2019 +0530
@@ -73,8 +73,10 @@
         raise error.Abort(msg, hint=hint)
     newunstable = disallowednewunstable(repo, revs)
     if newunstable:
-        msg = _(b"%s will orphan %i descendants")
-        msg %= (action, len(newunstable))
+        msg = _(b"performing '%s' in the middle of a stack will orphan %s")
+        if len(newunstable) > 1:
+            msg += (b" and its %d descendants") % (len(newunstable) - 1)
+        msg %= (action, repo[newunstable.first()])
         hint = _(b"see 'hg help evolution.instability'")
         raise error.Abort(msg, hint=hint)
     divrisk = revs_hascontentdivrisk(repo, revs)
--- a/tests/test-evolve.t	Sun Nov 10 16:32:34 2019 +0530
+++ b/tests/test-evolve.t	Sat Dec 14 13:31:45 2019 +0530
@@ -1239,7 +1239,7 @@
   $ hg up 274b6cd0c101^
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg uncommit --all
-  abort: uncommit will orphan 4 descendants
+  abort: performing 'uncommit' in the middle of a stack will orphan 0fd8bfb02de4 and its 3 descendants
   (see 'hg help evolution.instability')
   [255]
   $ hg up 274b6cd0c101
@@ -1296,11 +1296,11 @@
   $ mkcommit c5_
   created new head
   $ hg prune '0ef9ff75f8e2 + f1b85956c48c'
-  abort: prune will orphan 1 descendants
+  abort: performing 'prune' in the middle of a stack will orphan 0d9203b74542
   (see 'hg help evolution.instability')
   [255]
   $ hg prune '98e171e2f272::0d9203b74542'
-  abort: prune will orphan 1 descendants
+  abort: performing 'prune' in the middle of a stack will orphan 4c6f6f6d1976
   (see 'hg help evolution.instability')
   [255]
   $ hg prune '0ef9ff75f8e2::'
--- a/tests/test-fold.t	Sun Nov 10 16:32:34 2019 +0530
+++ b/tests/test-fold.t	Sat Dec 14 13:31:45 2019 +0530
@@ -198,11 +198,11 @@
   > evolution = createmarkers, allnewcommands
   > EOF
   $ hg fold --from 'desc("r4")'
-  abort: fold will orphan 1 descendants
+  abort: performing 'fold' in the middle of a stack will orphan 14d0e0da8e91
   (see 'hg help evolution.instability')
   [255]
   $ hg fold --from 'desc("r3")::desc("r11")'
-  abort: fold will orphan 1 descendants
+  abort: performing 'fold' in the middle of a stack will orphan b568edbee6e0
   (see 'hg help evolution.instability')
   [255]
 
--- a/tests/test-metaedit.t	Sun Nov 10 16:32:34 2019 +0530
+++ b/tests/test-metaedit.t	Sat Dec 14 13:31:45 2019 +0530
@@ -85,7 +85,7 @@
   (587528abfffe will become unstable and new unstable changes are not allowed)
   [255]
   $ hg metaedit 'desc(A)::desc(B)' --fold --config 'experimental.evolution=createmarkers, allnewcommands'
-  abort: fold will orphan 4 descendants
+  abort: performing 'fold' in the middle of a stack will orphan 3260958f1169 and its 3 descendants
   (see 'hg help evolution.instability')
   [255]
   $ hg metaedit --user foobar
--- a/tests/test-split.t	Sun Nov 10 16:32:34 2019 +0530
+++ b/tests/test-split.t	Sat Dec 14 13:31:45 2019 +0530
@@ -362,7 +362,7 @@
   > evolutioncommands=split
   > EOF
   $ hg split -r "desc(split3)"
-  abort: split will orphan 4 descendants
+  abort: performing 'split' in the middle of a stack will orphan 1188c4216eba and its 3 descendants
   (see 'hg help evolution.instability')
   [255]