Patchwork D10916: tests: demonstrate crash when trying to rewrite pruned part of a split

login
register
mail settings
Submitter phabricator
Date June 29, 2021, 9:20 p.m.
Message ID <differential-rev-PHID-DREV-ymtyswjywffkvxvxd2ed-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49230/
State Superseded
Headers show

Comments

phabricator - June 29, 2021, 9:20 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If you split a commit, prune one of the sides, and then try to revive
  that commit by adding a successor, you'll get a crash in the code that
  tries to detect divergence.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-amend.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -250,6 +250,41 @@ 
   [10]
   $ hg amend -m divergent --config experimental.evolution.allowdivergence=true
   2 new content-divergent changesets
+
+Amending pruned part of split commit does not cause crash
+
+  $ hg debugobsolete $(hg log  -T '{node}' -r .)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  $ hg co '.^'
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ node_B=$(hg log -T '{node}' -r 4)
+  $ hg revert -r $node_B -a
+  adding B
+  adding bar
+  $ hg ci -m B-split1
+  created new head
+  $ node_B_split1=$(hg log -T '{node}' -r .)
+  $ hg co '.^'
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  $ hg revert -r 4 -a
+  adding B
+  adding bar
+  $ hg ci -m B-split2
+  created new head
+  $ node_B_split2=$(hg log -T '{node}' -r .)
+  $ hg debugobsolete $node_B $node_B_split1 $node_B_split2
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  $ hg debugobsolete $node_B_split2
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  $ hg co --hidden $node_B_split2
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+BROKEN: Should not complain about a filtered predecessor
+  $ hg amend -m 'revived B-split2'
+  abort: filtered revision '16084da537dd8f84cfdb3055c633772269d62e1b' (known-bad-output !)
+  [255]
 #endif
 
 Cannot amend public changeset