Patchwork D9225: tests: add test showing how `hg fix -s` deals with obsolete and orphan nodes

login
register
mail settings
Submitter phabricator
Date Oct. 16, 2020, 11:04 p.m.
Message ID <differential-rev-PHID-DREV-djzk46ruvaidj5yrw4ag-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47487/
State New
Headers show

Comments

phabricator - Oct. 16, 2020, 11:04 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9225

AFFECTED FILES
  tests/test-fix-topology.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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