D10996: corruption: add a test for issue6528
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Tue Jul 6 18:07:15 UTC 2021
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
The initial reproduction script was provided by Charles Chamberlain from Jane
Street.
REPOSITORY
rHG Mercurial
BRANCH
stable
REVISION DETAIL
https://phab.mercurial-scm.org/D10996
AFFECTED FILES
tests/test-issue6528.t
CHANGE DETAILS
diff --git a/tests/test-issue6528.t b/tests/test-issue6528.t
new file mode 100644
--- /dev/null
+++ b/tests/test-issue6528.t
@@ -0,0 +1,171 @@
+===============================================================
+Test non-regression on the corruption associated with issue6528
+===============================================================
+
+Setup
+-----
+
+ $ hg init base-repo
+ $ cd base-repo
+
+ $ cat <<EOF > a.txt
+ > 1
+ > 1
+ > 2
+ > 3
+ > 4
+ > 5
+ > 6
+ > EOF
+
+ $ hg add a.txt
+ $ hg commit -m 'c_base_c - create a.txt'
+
+Modify a.txt
+
+ $ sed -i -e 's/1/wow/' a.txt
+ $ hg commit -qm 'c_modify_c - modify a.txt'
+
+Modify and rename a.txt to b.txt
+
+ $ hg up -qr "desc('c_base_c')"
+ $ sed -i -e 's/6/wow/' a.txt
+ $ hg mv a.txt b.txt
+ $ hg commit -m 'c_rename_c - rename and modify a.txt to b.txt'
+ created new head
+
+Merge each branch
+
+ $ hg merge -r "desc('c_modify_c')"
+ merging b.txt and a.txt to b.txt
+ 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+ (branch merge, don't forget to commit)
+ $ hg resolve --mark b.txt
+ (no more unresolved files)
+
+
+ $ hg commit -m 'c_merge_c: commit merge'
+
+ $ hg debugrevlogindex b.txt
+ rev linkrev nodeid p1 p2
+ 0 2 b2f69c4a7960 000000000000 000000000000
+ 1 3 df317307a6a4 000000000000 b2f69c4a7960
+
+Check commit Graph
+
+ $ hg log -G
+ @ changeset: 3:9a43fb7d5bfc
+ |\ tag: tip
+ | | parent: 2:b573f4ca0f80
+ | | parent: 1:5846047e2473
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: c_merge_c: commit merge
+ | |
+ | o changeset: 2:b573f4ca0f80
+ | | parent: 0:1859a1bc1dc4
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: c_rename_c - rename and modify a.txt to b.txt
+ | |
+ o | changeset: 1:5846047e2473
+ |/ user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: c_modify_c - modify a.txt
+ |
+ o changeset: 0:1859a1bc1dc4
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: c_base_c - create a.txt
+
+
+ $ hg cat -r . b.txt
+ wow
+ wow
+ 2
+ 3
+ 4
+ 5
+ wow
+ $ cat b.txt
+ wow
+ wow
+ 2
+ 3
+ 4
+ 5
+ wow
+ $ cd ..
+
+
+Check the lack of corruption
+----------------------------
+
+ $ hg clone --pull -q base-repo cloned
+ $ cd cloned
+ $ hg up -r "desc('c_merge_c')"
+ 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+
+Status is buggy, even with debugrebuilddirstate
+
+ $ hg cat -r . b.txt
+ wow
+ wow
+ 2
+ 3
+ 4
+ 5
+ wow
+ $ cat b.txt
+ wow
+ wow
+ 2
+ 3
+ 4
+ 5
+ wow
+ $ hg status
+ M b.txt (known-bad-output !)
+ $ hg debugrebuilddirstate
+ $ hg status
+ M b.txt (known-bad-output !)
+
+the history was altered
+
+in theory p1/p2 order does not matter but in practice p1 == nullid is used as a
+marker that some metadata are present and should be fetched.
+
+ $ hg debugrevlogindex b.txt
+ rev linkrev nodeid p1 p2
+ 0 2 b2f69c4a7960 000000000000 000000000000
+ 1 3 df317307a6a4 b2f69c4a7960 000000000000 (known-bad-output !)
+ 1 3 df317307a6a4 000000000000 b2f69c4a7960 (missing-correct-output !)
+
+Check commit Graph
+
+ $ hg log -G
+ @ changeset: 3:9a43fb7d5bfc
+ |\ tag: tip
+ | | parent: 2:b573f4ca0f80
+ | | parent: 1:5846047e2473
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: c_merge_c: commit merge
+ | |
+ | o changeset: 2:b573f4ca0f80
+ | | parent: 0:1859a1bc1dc4
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: c_rename_c - rename and modify a.txt to b.txt
+ | |
+ o | changeset: 1:5846047e2473
+ |/ user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: c_modify_c - modify a.txt
+ |
+ o changeset: 0:1859a1bc1dc4
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: c_base_c - create a.txt
+
To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list