##// END OF EJS Templates
corruption: add a test for issue6528...
marmoute -
r48354:bd0a2a91 stable
parent child Browse files
Show More
@@ -0,0 +1,171 b''
1 ===============================================================
2 Test non-regression on the corruption associated with issue6528
3 ===============================================================
4
5 Setup
6 -----
7
8 $ hg init base-repo
9 $ cd base-repo
10
11 $ cat <<EOF > a.txt
12 > 1
13 > 2
14 > 3
15 > 4
16 > 5
17 > 6
18 > EOF
19
20 $ hg add a.txt
21 $ hg commit -m 'c_base_c - create a.txt'
22
23 Modify a.txt
24
25 $ sed -e 's/1/foo/' a.txt > a.tmp; mv a.tmp a.txt
26 $ hg commit -m 'c_modify_c - modify a.txt'
27
28 Modify and rename a.txt to b.txt
29
30 $ hg up -r "desc('c_base_c')"
31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 $ sed -e 's/6/bar/' a.txt > a.tmp; mv a.tmp a.txt
33 $ hg mv a.txt b.txt
34 $ hg commit -m 'c_rename_c - rename and modify a.txt to b.txt'
35 created new head
36
37 Merge each branch
38
39 $ hg merge -r "desc('c_modify_c')"
40 merging b.txt and a.txt to b.txt
41 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
42 (branch merge, don't forget to commit)
43 $ hg commit -m 'c_merge_c: commit merge'
44
45 $ hg debugrevlogindex b.txt
46 rev linkrev nodeid p1 p2
47 0 2 05b806ebe5ea 000000000000 000000000000
48 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
49
50 Check commit Graph
51
52 $ hg log -G
53 @ changeset: 3:a1cc2bdca0aa
54 |\ tag: tip
55 | | parent: 2:615c6ccefd15
56 | | parent: 1:373d507f4667
57 | | user: test
58 | | date: Thu Jan 01 00:00:00 1970 +0000
59 | | summary: c_merge_c: commit merge
60 | |
61 | o changeset: 2:615c6ccefd15
62 | | parent: 0:f5a5a568022f
63 | | user: test
64 | | date: Thu Jan 01 00:00:00 1970 +0000
65 | | summary: c_rename_c - rename and modify a.txt to b.txt
66 | |
67 o | changeset: 1:373d507f4667
68 |/ user: test
69 | date: Thu Jan 01 00:00:00 1970 +0000
70 | summary: c_modify_c - modify a.txt
71 |
72 o changeset: 0:f5a5a568022f
73 user: test
74 date: Thu Jan 01 00:00:00 1970 +0000
75 summary: c_base_c - create a.txt
76
77
78 $ hg cat -r . b.txt
79 foo
80 2
81 3
82 4
83 5
84 bar
85 $ cat b.txt
86 foo
87 2
88 3
89 4
90 5
91 bar
92 $ cd ..
93
94
95 Check the lack of corruption
96 ----------------------------
97
98 $ hg clone --pull base-repo cloned
99 requesting all changes
100 adding changesets
101 adding manifests
102 adding file changes
103 added 4 changesets with 4 changes to 2 files
104 new changesets f5a5a568022f:a1cc2bdca0aa
105 updating to branch default
106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 $ cd cloned
108 $ hg up -r "desc('c_merge_c')"
109 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
110
111
112 Status is buggy, even with debugrebuilddirstate
113
114 $ hg cat -r . b.txt
115 foo
116 2
117 3
118 4
119 5
120 bar
121 $ cat b.txt
122 foo
123 2
124 3
125 4
126 5
127 bar
128 $ hg status
129 M b.txt (known-bad-output !)
130 $ hg debugrebuilddirstate
131 $ hg status
132 M b.txt (known-bad-output !)
133
134 the history was altered
135
136 in theory p1/p2 order does not matter but in practice p1 == nullid is used as a
137 marker that some metadata are present and should be fetched.
138
139 $ hg debugrevlogindex b.txt
140 rev linkrev nodeid p1 p2
141 0 2 05b806ebe5ea 000000000000 000000000000
142 1 3 a58b36ad6b65 05b806ebe5ea 000000000000 (known-bad-output !)
143 1 3 a58b36ad6b65 000000000000 05b806ebe5ea (missing-correct-output !)
144
145 Check commit Graph
146
147 $ hg log -G
148 @ changeset: 3:a1cc2bdca0aa
149 |\ tag: tip
150 | | parent: 2:615c6ccefd15
151 | | parent: 1:373d507f4667
152 | | user: test
153 | | date: Thu Jan 01 00:00:00 1970 +0000
154 | | summary: c_merge_c: commit merge
155 | |
156 | o changeset: 2:615c6ccefd15
157 | | parent: 0:f5a5a568022f
158 | | user: test
159 | | date: Thu Jan 01 00:00:00 1970 +0000
160 | | summary: c_rename_c - rename and modify a.txt to b.txt
161 | |
162 o | changeset: 1:373d507f4667
163 |/ user: test
164 | date: Thu Jan 01 00:00:00 1970 +0000
165 | summary: c_modify_c - modify a.txt
166 |
167 o changeset: 0:f5a5a568022f
168 user: test
169 date: Thu Jan 01 00:00:00 1970 +0000
170 summary: c_base_c - create a.txt
171
General Comments 0
You need to be logged in to leave comments. Login now