changeset 45808:15a98880cc07

tests: add test showing how `hg fix -s` deals with obsolete and orphan nodes We didn't have any tests for how `hg fix -s` behaves with obsolete commits among the descendants. The next patch will change the behavior in this area. Differential Revision: https://phab.mercurial-scm.org/D9225
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 16 Oct 2020 11:15:00 -0700
parents f90943d753ef
children 136a86327316
files tests/test-fix-topology.t
diffstat 1 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-fix-topology.t	Fri Oct 16 15:05:43 2020 -0700
+++ b/tests/test-fix-topology.t	Fri Oct 16 11:15:00 2020 -0700
@@ -22,6 +22,7 @@
   > [extensions]
   > fix =
   > strip =
+  > debugdrawdag=$TESTDIR/drawdag.py
   > [fix]
   > uppercase-whole-file:command="$PYTHON" $UPPERCASEPY
   > uppercase-whole-file:pattern=set:**
@@ -366,6 +367,40 @@
   XXXX
 
   $ cd ..
+
+  $ hg init exclude-obsolete
+  $ cd exclude-obsolete
+  $ hg debugdrawdag <<'EOS'
+  > E C # prune: C
+  > | |
+  > D B # prune: B, D
+  > |/
+  > A
+  > EOS
+  1 new orphan changesets
+  $ hg log --graph --template '{rev} {desc}\n'
+  *  4 E
+  |
+  | x  3 C
+  | |
+  x |  2 D
+  | |
+  | x  1 B
+  |/
+  o  0 A
+  
+  $ hg fix -s A
+  abort: fixing obsolete revision could cause divergence
+  [255]
+  $ hg fix -s B
+  abort: fixing obsolete revision could cause divergence
+  [255]
+  $ hg fix -s D
+  abort: fixing obsolete revision could cause divergence
+  [255]
+  $ hg fix -s E
+  $ cd ..
+
 #endif
 
 The --all flag should fix anything that wouldn't cause a problem if you fixed