# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1602872100 25200
#      Fri Oct 16 11:15:00 2020 -0700
# Node ID 15a98880cc07c59c053201f6ecfbcabcdd94614e
# Parent  f90943d753efb6ad78d26c3027e5a42e711be1ce
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

diff --git a/tests/test-fix-topology.t b/tests/test-fix-topology.t
--- a/tests/test-fix-topology.t
+++ b/tests/test-fix-topology.t
@@ -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