##// END OF EJS Templates
tests: fix tar invocation, to address issue 6740
Arseniy Alekseyev -
r50384:58e38c1a stable
parent child Browse files
Show More
@@ -1,611 +1,611 b''
1 ===============================================================
1 ===============================================================
2 Test non-regression on the corruption associated with issue6528
2 Test non-regression on the corruption associated with issue6528
3 ===============================================================
3 ===============================================================
4
4
5 Setup
5 Setup
6 =====
6 =====
7
7
8 $ hg init base-repo
8 $ hg init base-repo
9 $ cd base-repo
9 $ cd base-repo
10
10
11 $ cat <<EOF > a.txt
11 $ cat <<EOF > a.txt
12 > 1
12 > 1
13 > 2
13 > 2
14 > 3
14 > 3
15 > 4
15 > 4
16 > 5
16 > 5
17 > 6
17 > 6
18 > EOF
18 > EOF
19
19
20 $ hg add a.txt
20 $ hg add a.txt
21 $ hg commit -m 'c_base_c - create a.txt'
21 $ hg commit -m 'c_base_c - create a.txt'
22
22
23 Modify a.txt
23 Modify a.txt
24
24
25 $ sed -e 's/1/foo/' a.txt > a.tmp; mv a.tmp a.txt
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'
26 $ hg commit -m 'c_modify_c - modify a.txt'
27
27
28 Modify and rename a.txt to b.txt
28 Modify and rename a.txt to b.txt
29
29
30 $ hg up -r "desc('c_base_c')"
30 $ hg up -r "desc('c_base_c')"
31 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
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
32 $ sed -e 's/6/bar/' a.txt > a.tmp; mv a.tmp a.txt
33 $ hg mv a.txt b.txt
33 $ hg mv a.txt b.txt
34 $ hg commit -m 'c_rename_c - rename and modify a.txt to b.txt'
34 $ hg commit -m 'c_rename_c - rename and modify a.txt to b.txt'
35 created new head
35 created new head
36
36
37 Merge each branch
37 Merge each branch
38
38
39 $ hg merge -r "desc('c_modify_c')"
39 $ hg merge -r "desc('c_modify_c')"
40 merging b.txt and a.txt to b.txt
40 merging b.txt and a.txt to b.txt
41 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
41 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
42 (branch merge, don't forget to commit)
42 (branch merge, don't forget to commit)
43 $ hg commit -m 'c_merge_c: commit merge'
43 $ hg commit -m 'c_merge_c: commit merge'
44
44
45 $ hg debugrevlogindex b.txt
45 $ hg debugrevlogindex b.txt
46 rev linkrev nodeid p1 p2
46 rev linkrev nodeid p1 p2
47 0 2 05b806ebe5ea 000000000000 000000000000
47 0 2 05b806ebe5ea 000000000000 000000000000
48 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
48 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
49
49
50 Check commit Graph
50 Check commit Graph
51
51
52 $ hg log -G
52 $ hg log -G
53 @ changeset: 3:a1cc2bdca0aa
53 @ changeset: 3:a1cc2bdca0aa
54 |\ tag: tip
54 |\ tag: tip
55 | | parent: 2:615c6ccefd15
55 | | parent: 2:615c6ccefd15
56 | | parent: 1:373d507f4667
56 | | parent: 1:373d507f4667
57 | | user: test
57 | | user: test
58 | | date: Thu Jan 01 00:00:00 1970 +0000
58 | | date: Thu Jan 01 00:00:00 1970 +0000
59 | | summary: c_merge_c: commit merge
59 | | summary: c_merge_c: commit merge
60 | |
60 | |
61 | o changeset: 2:615c6ccefd15
61 | o changeset: 2:615c6ccefd15
62 | | parent: 0:f5a5a568022f
62 | | parent: 0:f5a5a568022f
63 | | user: test
63 | | user: test
64 | | date: Thu Jan 01 00:00:00 1970 +0000
64 | | date: Thu Jan 01 00:00:00 1970 +0000
65 | | summary: c_rename_c - rename and modify a.txt to b.txt
65 | | summary: c_rename_c - rename and modify a.txt to b.txt
66 | |
66 | |
67 o | changeset: 1:373d507f4667
67 o | changeset: 1:373d507f4667
68 |/ user: test
68 |/ user: test
69 | date: Thu Jan 01 00:00:00 1970 +0000
69 | date: Thu Jan 01 00:00:00 1970 +0000
70 | summary: c_modify_c - modify a.txt
70 | summary: c_modify_c - modify a.txt
71 |
71 |
72 o changeset: 0:f5a5a568022f
72 o changeset: 0:f5a5a568022f
73 user: test
73 user: test
74 date: Thu Jan 01 00:00:00 1970 +0000
74 date: Thu Jan 01 00:00:00 1970 +0000
75 summary: c_base_c - create a.txt
75 summary: c_base_c - create a.txt
76
76
77
77
78 $ hg cat -r . b.txt
78 $ hg cat -r . b.txt
79 foo
79 foo
80 2
80 2
81 3
81 3
82 4
82 4
83 5
83 5
84 bar
84 bar
85 $ cat b.txt
85 $ cat b.txt
86 foo
86 foo
87 2
87 2
88 3
88 3
89 4
89 4
90 5
90 5
91 bar
91 bar
92 $ cd ..
92 $ cd ..
93
93
94
94
95 Check the lack of corruption
95 Check the lack of corruption
96 ============================
96 ============================
97
97
98 $ hg clone --pull base-repo cloned
98 $ hg clone --pull base-repo cloned
99 requesting all changes
99 requesting all changes
100 adding changesets
100 adding changesets
101 adding manifests
101 adding manifests
102 adding file changes
102 adding file changes
103 added 4 changesets with 4 changes to 2 files
103 added 4 changesets with 4 changes to 2 files
104 new changesets f5a5a568022f:a1cc2bdca0aa
104 new changesets f5a5a568022f:a1cc2bdca0aa
105 updating to branch default
105 updating to branch default
106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 $ cd cloned
107 $ cd cloned
108 $ hg up -r "desc('c_merge_c')"
108 $ hg up -r "desc('c_merge_c')"
109 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
110
110
111
111
112 Status is buggy, even with debugrebuilddirstate
112 Status is buggy, even with debugrebuilddirstate
113
113
114 $ hg cat -r . b.txt
114 $ hg cat -r . b.txt
115 foo
115 foo
116 2
116 2
117 3
117 3
118 4
118 4
119 5
119 5
120 bar
120 bar
121 $ cat b.txt
121 $ cat b.txt
122 foo
122 foo
123 2
123 2
124 3
124 3
125 4
125 4
126 5
126 5
127 bar
127 bar
128 $ hg status
128 $ hg status
129 $ hg debugrebuilddirstate
129 $ hg debugrebuilddirstate
130 $ hg status
130 $ hg status
131
131
132 the history was altered
132 the history was altered
133
133
134 in theory p1/p2 order does not matter but in practice p1 == nullid is used as a
134 in theory p1/p2 order does not matter but in practice p1 == nullid is used as a
135 marker that some metadata are present and should be fetched.
135 marker that some metadata are present and should be fetched.
136
136
137 $ hg debugrevlogindex b.txt
137 $ hg debugrevlogindex b.txt
138 rev linkrev nodeid p1 p2
138 rev linkrev nodeid p1 p2
139 0 2 05b806ebe5ea 000000000000 000000000000
139 0 2 05b806ebe5ea 000000000000 000000000000
140 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
140 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
141
141
142 Check commit Graph
142 Check commit Graph
143
143
144 $ hg log -G
144 $ hg log -G
145 @ changeset: 3:a1cc2bdca0aa
145 @ changeset: 3:a1cc2bdca0aa
146 |\ tag: tip
146 |\ tag: tip
147 | | parent: 2:615c6ccefd15
147 | | parent: 2:615c6ccefd15
148 | | parent: 1:373d507f4667
148 | | parent: 1:373d507f4667
149 | | user: test
149 | | user: test
150 | | date: Thu Jan 01 00:00:00 1970 +0000
150 | | date: Thu Jan 01 00:00:00 1970 +0000
151 | | summary: c_merge_c: commit merge
151 | | summary: c_merge_c: commit merge
152 | |
152 | |
153 | o changeset: 2:615c6ccefd15
153 | o changeset: 2:615c6ccefd15
154 | | parent: 0:f5a5a568022f
154 | | parent: 0:f5a5a568022f
155 | | user: test
155 | | user: test
156 | | date: Thu Jan 01 00:00:00 1970 +0000
156 | | date: Thu Jan 01 00:00:00 1970 +0000
157 | | summary: c_rename_c - rename and modify a.txt to b.txt
157 | | summary: c_rename_c - rename and modify a.txt to b.txt
158 | |
158 | |
159 o | changeset: 1:373d507f4667
159 o | changeset: 1:373d507f4667
160 |/ user: test
160 |/ user: test
161 | date: Thu Jan 01 00:00:00 1970 +0000
161 | date: Thu Jan 01 00:00:00 1970 +0000
162 | summary: c_modify_c - modify a.txt
162 | summary: c_modify_c - modify a.txt
163 |
163 |
164 o changeset: 0:f5a5a568022f
164 o changeset: 0:f5a5a568022f
165 user: test
165 user: test
166 date: Thu Jan 01 00:00:00 1970 +0000
166 date: Thu Jan 01 00:00:00 1970 +0000
167 summary: c_base_c - create a.txt
167 summary: c_base_c - create a.txt
168
168
169
169
170 Test the command that fixes the issue
170 Test the command that fixes the issue
171 =====================================
171 =====================================
172
172
173 Restore a broken repository with multiple broken revisions and a filename that
173 Restore a broken repository with multiple broken revisions and a filename that
174 would get encoded to test the `report` options.
174 would get encoded to test the `report` options.
175 It's a tarball because unbundle might magically fix the issue later.
175 It's a tarball because unbundle might magically fix the issue later.
176
176
177 $ cd ..
177 $ cd ..
178 $ mkdir repo-to-fix
178 $ mkdir repo-to-fix
179 $ cd repo-to-fix
179 $ cd repo-to-fix
180 $ tar -x < $TESTDIR/bundles/issue6528.tar
180 $ tar -xf - < "$TESTDIR"/bundles/issue6528.tar
181
181
182 Check that the issue is present
182 Check that the issue is present
183 (It is currently not present with rhg but will be when optimizations are added
183 (It is currently not present with rhg but will be when optimizations are added
184 to resolve ambiguous files at the end of status without reading their content
184 to resolve ambiguous files at the end of status without reading their content
185 if the size differs, and reading the expected size without resolving filelog
185 if the size differs, and reading the expected size without resolving filelog
186 deltas where possible.)
186 deltas where possible.)
187
187
188 $ hg st
188 $ hg st
189 M D.txt
189 M D.txt
190 M b.txt
190 M b.txt
191 $ hg debugrevlogindex b.txt
191 $ hg debugrevlogindex b.txt
192 rev linkrev nodeid p1 p2
192 rev linkrev nodeid p1 p2
193 0 2 05b806ebe5ea 000000000000 000000000000
193 0 2 05b806ebe5ea 000000000000 000000000000
194 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
194 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
195 2 6 216a5fe8b8ed 000000000000 000000000000
195 2 6 216a5fe8b8ed 000000000000 000000000000
196 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
196 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
197 $ hg debugrevlogindex D.txt
197 $ hg debugrevlogindex D.txt
198 rev linkrev nodeid p1 p2
198 rev linkrev nodeid p1 p2
199 0 6 2a8d3833f2fb 000000000000 000000000000
199 0 6 2a8d3833f2fb 000000000000 000000000000
200 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
200 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
201
201
202 Dry-run the fix
202 Dry-run the fix
203 $ hg debug-repair-issue6528 --dry-run
203 $ hg debug-repair-issue6528 --dry-run
204 found affected revision 1 for filelog 'data/D.txt.i'
204 found affected revision 1 for filelog 'data/D.txt.i'
205 found affected revision 1 for filelog 'data/b.txt.i'
205 found affected revision 1 for filelog 'data/b.txt.i'
206 found affected revision 3 for filelog 'data/b.txt.i'
206 found affected revision 3 for filelog 'data/b.txt.i'
207 $ hg st
207 $ hg st
208 M D.txt
208 M D.txt
209 M b.txt
209 M b.txt
210 $ hg debugrevlogindex b.txt
210 $ hg debugrevlogindex b.txt
211 rev linkrev nodeid p1 p2
211 rev linkrev nodeid p1 p2
212 0 2 05b806ebe5ea 000000000000 000000000000
212 0 2 05b806ebe5ea 000000000000 000000000000
213 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
213 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
214 2 6 216a5fe8b8ed 000000000000 000000000000
214 2 6 216a5fe8b8ed 000000000000 000000000000
215 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
215 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
216 $ hg debugrevlogindex D.txt
216 $ hg debugrevlogindex D.txt
217 rev linkrev nodeid p1 p2
217 rev linkrev nodeid p1 p2
218 0 6 2a8d3833f2fb 000000000000 000000000000
218 0 6 2a8d3833f2fb 000000000000 000000000000
219 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
219 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
220
220
221 Test the --paranoid option
221 Test the --paranoid option
222 $ hg debug-repair-issue6528 --dry-run --paranoid
222 $ hg debug-repair-issue6528 --dry-run --paranoid
223 found affected revision 1 for filelog 'data/D.txt.i'
223 found affected revision 1 for filelog 'data/D.txt.i'
224 found affected revision 1 for filelog 'data/b.txt.i'
224 found affected revision 1 for filelog 'data/b.txt.i'
225 found affected revision 3 for filelog 'data/b.txt.i'
225 found affected revision 3 for filelog 'data/b.txt.i'
226 $ hg st
226 $ hg st
227 M D.txt
227 M D.txt
228 M b.txt
228 M b.txt
229 $ hg debugrevlogindex b.txt
229 $ hg debugrevlogindex b.txt
230 rev linkrev nodeid p1 p2
230 rev linkrev nodeid p1 p2
231 0 2 05b806ebe5ea 000000000000 000000000000
231 0 2 05b806ebe5ea 000000000000 000000000000
232 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
232 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
233 2 6 216a5fe8b8ed 000000000000 000000000000
233 2 6 216a5fe8b8ed 000000000000 000000000000
234 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
234 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
235 $ hg debugrevlogindex D.txt
235 $ hg debugrevlogindex D.txt
236 rev linkrev nodeid p1 p2
236 rev linkrev nodeid p1 p2
237 0 6 2a8d3833f2fb 000000000000 000000000000
237 0 6 2a8d3833f2fb 000000000000 000000000000
238 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
238 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
239
239
240 Run the fix
240 Run the fix
241 $ hg debug-repair-issue6528
241 $ hg debug-repair-issue6528
242 found affected revision 1 for filelog 'data/D.txt.i'
242 found affected revision 1 for filelog 'data/D.txt.i'
243 repaired revision 1 of 'filelog data/D.txt.i'
243 repaired revision 1 of 'filelog data/D.txt.i'
244 found affected revision 1 for filelog 'data/b.txt.i'
244 found affected revision 1 for filelog 'data/b.txt.i'
245 found affected revision 3 for filelog 'data/b.txt.i'
245 found affected revision 3 for filelog 'data/b.txt.i'
246 repaired revision 1 of 'filelog data/b.txt.i'
246 repaired revision 1 of 'filelog data/b.txt.i'
247 repaired revision 3 of 'filelog data/b.txt.i'
247 repaired revision 3 of 'filelog data/b.txt.i'
248
248
249 Check that the fix worked and that running it twice does nothing
249 Check that the fix worked and that running it twice does nothing
250 $ hg st
250 $ hg st
251 $ hg debugrevlogindex b.txt
251 $ hg debugrevlogindex b.txt
252 rev linkrev nodeid p1 p2
252 rev linkrev nodeid p1 p2
253 0 2 05b806ebe5ea 000000000000 000000000000
253 0 2 05b806ebe5ea 000000000000 000000000000
254 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
254 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
255 2 6 216a5fe8b8ed 000000000000 000000000000
255 2 6 216a5fe8b8ed 000000000000 000000000000
256 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
256 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
257 $ hg debugrevlogindex D.txt
257 $ hg debugrevlogindex D.txt
258 rev linkrev nodeid p1 p2
258 rev linkrev nodeid p1 p2
259 0 6 2a8d3833f2fb 000000000000 000000000000
259 0 6 2a8d3833f2fb 000000000000 000000000000
260 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
260 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
261 $ hg debug-repair-issue6528
261 $ hg debug-repair-issue6528
262 no affected revisions were found
262 no affected revisions were found
263 $ hg st
263 $ hg st
264 $ hg debugrevlogindex b.txt
264 $ hg debugrevlogindex b.txt
265 rev linkrev nodeid p1 p2
265 rev linkrev nodeid p1 p2
266 0 2 05b806ebe5ea 000000000000 000000000000
266 0 2 05b806ebe5ea 000000000000 000000000000
267 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
267 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
268 2 6 216a5fe8b8ed 000000000000 000000000000
268 2 6 216a5fe8b8ed 000000000000 000000000000
269 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
269 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
270 $ hg debugrevlogindex D.txt
270 $ hg debugrevlogindex D.txt
271 rev linkrev nodeid p1 p2
271 rev linkrev nodeid p1 p2
272 0 6 2a8d3833f2fb 000000000000 000000000000
272 0 6 2a8d3833f2fb 000000000000 000000000000
273 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
273 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
274
274
275 Try the using the report options
275 Try the using the report options
276 --------------------------------
276 --------------------------------
277
277
278 $ cd ..
278 $ cd ..
279 $ mkdir repo-to-fix-report
279 $ mkdir repo-to-fix-report
280 $ cd repo-to-fix
280 $ cd repo-to-fix
281 $ tar -x < "$TESTDIR"/bundles/issue6528.tar
281 $ tar -xf - < "$TESTDIR"/bundles/issue6528.tar
282
282
283 $ hg debug-repair-issue6528 --to-report $TESTTMP/report.txt
283 $ hg debug-repair-issue6528 --to-report $TESTTMP/report.txt
284 found affected revision 1 for filelog 'data/D.txt.i'
284 found affected revision 1 for filelog 'data/D.txt.i'
285 found affected revision 1 for filelog 'data/b.txt.i'
285 found affected revision 1 for filelog 'data/b.txt.i'
286 found affected revision 3 for filelog 'data/b.txt.i'
286 found affected revision 3 for filelog 'data/b.txt.i'
287 $ cat $TESTTMP/report.txt
287 $ cat $TESTTMP/report.txt
288 2a80419dfc31d7dfb308ac40f3f138282de7d73b D.txt
288 2a80419dfc31d7dfb308ac40f3f138282de7d73b D.txt
289 a58b36ad6b6545195952793099613c2116f3563b,ea4f2f2463cca5b29ddf3461012b8ce5c6dac175 b.txt
289 a58b36ad6b6545195952793099613c2116f3563b,ea4f2f2463cca5b29ddf3461012b8ce5c6dac175 b.txt
290
290
291 $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt --dry-run
291 $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt --dry-run
292 loading report file '$TESTTMP/report.txt'
292 loading report file '$TESTTMP/report.txt'
293 found affected revision 1 for filelog 'D.txt'
293 found affected revision 1 for filelog 'D.txt'
294 found affected revision 1 for filelog 'b.txt'
294 found affected revision 1 for filelog 'b.txt'
295 found affected revision 3 for filelog 'b.txt'
295 found affected revision 3 for filelog 'b.txt'
296 $ hg st
296 $ hg st
297 M D.txt
297 M D.txt
298 M b.txt
298 M b.txt
299 $ hg debugrevlogindex b.txt
299 $ hg debugrevlogindex b.txt
300 rev linkrev nodeid p1 p2
300 rev linkrev nodeid p1 p2
301 0 2 05b806ebe5ea 000000000000 000000000000
301 0 2 05b806ebe5ea 000000000000 000000000000
302 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
302 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
303 2 6 216a5fe8b8ed 000000000000 000000000000
303 2 6 216a5fe8b8ed 000000000000 000000000000
304 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
304 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
305 $ hg debugrevlogindex D.txt
305 $ hg debugrevlogindex D.txt
306 rev linkrev nodeid p1 p2
306 rev linkrev nodeid p1 p2
307 0 6 2a8d3833f2fb 000000000000 000000000000
307 0 6 2a8d3833f2fb 000000000000 000000000000
308 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
308 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
309
309
310 $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt
310 $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt
311 loading report file '$TESTTMP/report.txt'
311 loading report file '$TESTTMP/report.txt'
312 found affected revision 1 for filelog 'D.txt'
312 found affected revision 1 for filelog 'D.txt'
313 repaired revision 1 of 'filelog data/D.txt.i'
313 repaired revision 1 of 'filelog data/D.txt.i'
314 found affected revision 1 for filelog 'b.txt'
314 found affected revision 1 for filelog 'b.txt'
315 found affected revision 3 for filelog 'b.txt'
315 found affected revision 3 for filelog 'b.txt'
316 repaired revision 1 of 'filelog data/b.txt.i'
316 repaired revision 1 of 'filelog data/b.txt.i'
317 repaired revision 3 of 'filelog data/b.txt.i'
317 repaired revision 3 of 'filelog data/b.txt.i'
318 $ hg st
318 $ hg st
319 $ hg debugrevlogindex b.txt
319 $ hg debugrevlogindex b.txt
320 rev linkrev nodeid p1 p2
320 rev linkrev nodeid p1 p2
321 0 2 05b806ebe5ea 000000000000 000000000000
321 0 2 05b806ebe5ea 000000000000 000000000000
322 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
322 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
323 2 6 216a5fe8b8ed 000000000000 000000000000
323 2 6 216a5fe8b8ed 000000000000 000000000000
324 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
324 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
325 $ hg debugrevlogindex D.txt
325 $ hg debugrevlogindex D.txt
326 rev linkrev nodeid p1 p2
326 rev linkrev nodeid p1 p2
327 0 6 2a8d3833f2fb 000000000000 000000000000
327 0 6 2a8d3833f2fb 000000000000 000000000000
328 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
328 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
329
329
330 Check that the revision is not "fixed" again
330 Check that the revision is not "fixed" again
331
331
332 $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt
332 $ hg debug-repair-issue6528 --from-report $TESTTMP/report.txt
333 loading report file '$TESTTMP/report.txt'
333 loading report file '$TESTTMP/report.txt'
334 revision 2a80419dfc31d7dfb308ac40f3f138282de7d73b of file 'D.txt' is not affected
334 revision 2a80419dfc31d7dfb308ac40f3f138282de7d73b of file 'D.txt' is not affected
335 no affected revisions were found for 'D.txt'
335 no affected revisions were found for 'D.txt'
336 revision a58b36ad6b6545195952793099613c2116f3563b of file 'b.txt' is not affected
336 revision a58b36ad6b6545195952793099613c2116f3563b of file 'b.txt' is not affected
337 revision ea4f2f2463cca5b29ddf3461012b8ce5c6dac175 of file 'b.txt' is not affected
337 revision ea4f2f2463cca5b29ddf3461012b8ce5c6dac175 of file 'b.txt' is not affected
338 no affected revisions were found for 'b.txt'
338 no affected revisions were found for 'b.txt'
339 $ hg st
339 $ hg st
340 $ hg debugrevlogindex b.txt
340 $ hg debugrevlogindex b.txt
341 rev linkrev nodeid p1 p2
341 rev linkrev nodeid p1 p2
342 0 2 05b806ebe5ea 000000000000 000000000000
342 0 2 05b806ebe5ea 000000000000 000000000000
343 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
343 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
344 2 6 216a5fe8b8ed 000000000000 000000000000
344 2 6 216a5fe8b8ed 000000000000 000000000000
345 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
345 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
346 $ hg debugrevlogindex D.txt
346 $ hg debugrevlogindex D.txt
347 rev linkrev nodeid p1 p2
347 rev linkrev nodeid p1 p2
348 0 6 2a8d3833f2fb 000000000000 000000000000
348 0 6 2a8d3833f2fb 000000000000 000000000000
349 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
349 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
350
350
351 Try it with a non-inline revlog
351 Try it with a non-inline revlog
352 -------------------------------
352 -------------------------------
353
353
354 $ cd ..
354 $ cd ..
355 $ mkdir $TESTTMP/ext
355 $ mkdir $TESTTMP/ext
356 $ cat << EOF > $TESTTMP/ext/small_inline.py
356 $ cat << EOF > $TESTTMP/ext/small_inline.py
357 > from mercurial import revlog
357 > from mercurial import revlog
358 > revlog._maxinline = 8
358 > revlog._maxinline = 8
359 > EOF
359 > EOF
360
360
361 $ cat << EOF >> $HGRCPATH
361 $ cat << EOF >> $HGRCPATH
362 > [extensions]
362 > [extensions]
363 > small_inline=$TESTTMP/ext/small_inline.py
363 > small_inline=$TESTTMP/ext/small_inline.py
364 > EOF
364 > EOF
365
365
366 $ mkdir repo-to-fix-not-inline
366 $ mkdir repo-to-fix-not-inline
367 $ cd repo-to-fix-not-inline
367 $ cd repo-to-fix-not-inline
368 $ tar -x < "$TESTDIR"/bundles/issue6528.tar
368 $ tar -xf - < "$TESTDIR"/bundles/issue6528.tar
369 $ echo b >> b.txt
369 $ echo b >> b.txt
370 $ hg commit -qm "inline -> separate"
370 $ hg commit -qm "inline -> separate"
371 $ find .hg -name *b.txt.d
371 $ find .hg -name *b.txt.d
372 .hg/store/data/b.txt.d
372 .hg/store/data/b.txt.d
373
373
374 Status is correct, but the problem is still there, in the earlier revision
374 Status is correct, but the problem is still there, in the earlier revision
375 $ hg st
375 $ hg st
376 $ hg up 3
376 $ hg up 3
377 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
377 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
378 $ hg st
378 $ hg st
379 M b.txt
379 M b.txt
380 $ hg debugrevlogindex b.txt
380 $ hg debugrevlogindex b.txt
381 rev linkrev nodeid p1 p2
381 rev linkrev nodeid p1 p2
382 0 2 05b806ebe5ea 000000000000 000000000000
382 0 2 05b806ebe5ea 000000000000 000000000000
383 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
383 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
384 2 6 216a5fe8b8ed 000000000000 000000000000
384 2 6 216a5fe8b8ed 000000000000 000000000000
385 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
385 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
386 4 8 db234885e2fe ea4f2f2463cc 000000000000
386 4 8 db234885e2fe ea4f2f2463cc 000000000000
387 $ hg debugrevlogindex D.txt
387 $ hg debugrevlogindex D.txt
388 rev linkrev nodeid p1 p2
388 rev linkrev nodeid p1 p2
389 0 6 2a8d3833f2fb 000000000000 000000000000
389 0 6 2a8d3833f2fb 000000000000 000000000000
390 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
390 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
391 2 8 65aecc89bb5d 2a80419dfc31 000000000000
391 2 8 65aecc89bb5d 2a80419dfc31 000000000000
392
392
393 Run the fix on the non-inline revlog
393 Run the fix on the non-inline revlog
394 $ hg debug-repair-issue6528
394 $ hg debug-repair-issue6528
395 found affected revision 1 for filelog 'data/D.txt.i'
395 found affected revision 1 for filelog 'data/D.txt.i'
396 repaired revision 1 of 'filelog data/D.txt.i'
396 repaired revision 1 of 'filelog data/D.txt.i'
397 found affected revision 1 for filelog 'data/b.txt.i'
397 found affected revision 1 for filelog 'data/b.txt.i'
398 found affected revision 3 for filelog 'data/b.txt.i'
398 found affected revision 3 for filelog 'data/b.txt.i'
399 repaired revision 1 of 'filelog data/b.txt.i'
399 repaired revision 1 of 'filelog data/b.txt.i'
400 repaired revision 3 of 'filelog data/b.txt.i'
400 repaired revision 3 of 'filelog data/b.txt.i'
401
401
402 Check that it worked
402 Check that it worked
403 $ hg debugrevlogindex b.txt
403 $ hg debugrevlogindex b.txt
404 rev linkrev nodeid p1 p2
404 rev linkrev nodeid p1 p2
405 0 2 05b806ebe5ea 000000000000 000000000000
405 0 2 05b806ebe5ea 000000000000 000000000000
406 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
406 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
407 2 6 216a5fe8b8ed 000000000000 000000000000
407 2 6 216a5fe8b8ed 000000000000 000000000000
408 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
408 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
409 4 8 db234885e2fe ea4f2f2463cc 000000000000
409 4 8 db234885e2fe ea4f2f2463cc 000000000000
410 $ hg debugrevlogindex D.txt
410 $ hg debugrevlogindex D.txt
411 rev linkrev nodeid p1 p2
411 rev linkrev nodeid p1 p2
412 0 6 2a8d3833f2fb 000000000000 000000000000
412 0 6 2a8d3833f2fb 000000000000 000000000000
413 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
413 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
414 2 8 65aecc89bb5d 2a80419dfc31 000000000000
414 2 8 65aecc89bb5d 2a80419dfc31 000000000000
415 $ hg debug-repair-issue6528
415 $ hg debug-repair-issue6528
416 no affected revisions were found
416 no affected revisions were found
417 $ hg st
417 $ hg st
418
418
419 $ cd ..
419 $ cd ..
420
420
421 Applying a bad bundle should fix it on the fly
421 Applying a bad bundle should fix it on the fly
422 ----------------------------------------------
422 ----------------------------------------------
423
423
424 from a v1 bundle
424 from a v1 bundle
425 ~~~~~~~~~~~~~~~~
425 ~~~~~~~~~~~~~~~~
426
426
427 $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v1
427 $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v1
428 bzip2-v1
428 bzip2-v1
429
429
430 $ hg init unbundle-v1
430 $ hg init unbundle-v1
431 $ cd unbundle-v1
431 $ cd unbundle-v1
432
432
433 $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v1
433 $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v1
434 adding changesets
434 adding changesets
435 adding manifests
435 adding manifests
436 adding file changes
436 adding file changes
437 added 8 changesets with 12 changes to 4 files
437 added 8 changesets with 12 changes to 4 files
438 new changesets f5a5a568022f:3beabb508514 (8 drafts)
438 new changesets f5a5a568022f:3beabb508514 (8 drafts)
439 (run 'hg update' to get a working copy)
439 (run 'hg update' to get a working copy)
440
440
441 Check that revision were fixed on the fly
441 Check that revision were fixed on the fly
442
442
443 $ hg debugrevlogindex b.txt
443 $ hg debugrevlogindex b.txt
444 rev linkrev nodeid p1 p2
444 rev linkrev nodeid p1 p2
445 0 2 05b806ebe5ea 000000000000 000000000000
445 0 2 05b806ebe5ea 000000000000 000000000000
446 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
446 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
447 2 6 216a5fe8b8ed 000000000000 000000000000
447 2 6 216a5fe8b8ed 000000000000 000000000000
448 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
448 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
449
449
450 $ hg debugrevlogindex D.txt
450 $ hg debugrevlogindex D.txt
451 rev linkrev nodeid p1 p2
451 rev linkrev nodeid p1 p2
452 0 6 2a8d3833f2fb 000000000000 000000000000
452 0 6 2a8d3833f2fb 000000000000 000000000000
453 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
453 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
454
454
455 That we don't see the symptoms of the bug
455 That we don't see the symptoms of the bug
456
456
457 $ hg up -- -1
457 $ hg up -- -1
458 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
458 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 $ hg status
459 $ hg status
460
460
461 And that the repair command does not find anything to fix
461 And that the repair command does not find anything to fix
462
462
463 $ hg debug-repair-issue6528
463 $ hg debug-repair-issue6528
464 no affected revisions were found
464 no affected revisions were found
465
465
466 $ cd ..
466 $ cd ..
467
467
468 from a v2 bundle
468 from a v2 bundle
469 ~~~~~~~~~~~~~~~~
469 ~~~~~~~~~~~~~~~~
470
470
471 $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v2
471 $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v2
472 bzip2-v2
472 bzip2-v2
473
473
474 $ hg init unbundle-v2
474 $ hg init unbundle-v2
475 $ cd unbundle-v2
475 $ cd unbundle-v2
476
476
477 $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v2
477 $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v2
478 adding changesets
478 adding changesets
479 adding manifests
479 adding manifests
480 adding file changes
480 adding file changes
481 added 8 changesets with 12 changes to 4 files
481 added 8 changesets with 12 changes to 4 files
482 new changesets f5a5a568022f:3beabb508514 (8 drafts)
482 new changesets f5a5a568022f:3beabb508514 (8 drafts)
483 (run 'hg update' to get a working copy)
483 (run 'hg update' to get a working copy)
484
484
485 Check that revision were fixed on the fly
485 Check that revision were fixed on the fly
486
486
487 $ hg debugrevlogindex b.txt
487 $ hg debugrevlogindex b.txt
488 rev linkrev nodeid p1 p2
488 rev linkrev nodeid p1 p2
489 0 2 05b806ebe5ea 000000000000 000000000000
489 0 2 05b806ebe5ea 000000000000 000000000000
490 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
490 1 3 a58b36ad6b65 000000000000 05b806ebe5ea
491 2 6 216a5fe8b8ed 000000000000 000000000000
491 2 6 216a5fe8b8ed 000000000000 000000000000
492 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
492 3 7 ea4f2f2463cc 000000000000 216a5fe8b8ed
493
493
494 $ hg debugrevlogindex D.txt
494 $ hg debugrevlogindex D.txt
495 rev linkrev nodeid p1 p2
495 rev linkrev nodeid p1 p2
496 0 6 2a8d3833f2fb 000000000000 000000000000
496 0 6 2a8d3833f2fb 000000000000 000000000000
497 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
497 1 7 2a80419dfc31 000000000000 2a8d3833f2fb
498
498
499 That we don't see the symptoms of the bug
499 That we don't see the symptoms of the bug
500
500
501 $ hg up -- -1
501 $ hg up -- -1
502 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
502 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
503 $ hg status
503 $ hg status
504
504
505 And that the repair command does not find anything to fix
505 And that the repair command does not find anything to fix
506
506
507 $ hg debug-repair-issue6528
507 $ hg debug-repair-issue6528
508 no affected revisions were found
508 no affected revisions were found
509
509
510 $ cd ..
510 $ cd ..
511
511
512 A config option can disable the fixing of the bad bundle on the fly
512 A config option can disable the fixing of the bad bundle on the fly
513 -------------------------------------------------------------------
513 -------------------------------------------------------------------
514
514
515
515
516
516
517 from a v1 bundle
517 from a v1 bundle
518 ~~~~~~~~~~~~~~~~
518 ~~~~~~~~~~~~~~~~
519
519
520 $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v1
520 $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v1
521 bzip2-v1
521 bzip2-v1
522
522
523 $ hg init unbundle-v1-no-fix
523 $ hg init unbundle-v1-no-fix
524 $ cd unbundle-v1-no-fix
524 $ cd unbundle-v1-no-fix
525
525
526 $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v1 --config storage.revlog.issue6528.fix-incoming=no
526 $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v1 --config storage.revlog.issue6528.fix-incoming=no
527 adding changesets
527 adding changesets
528 adding manifests
528 adding manifests
529 adding file changes
529 adding file changes
530 added 8 changesets with 12 changes to 4 files
530 added 8 changesets with 12 changes to 4 files
531 new changesets f5a5a568022f:3beabb508514 (8 drafts)
531 new changesets f5a5a568022f:3beabb508514 (8 drafts)
532 (run 'hg update' to get a working copy)
532 (run 'hg update' to get a working copy)
533
533
534 Check that revision were not fixed on the fly
534 Check that revision were not fixed on the fly
535
535
536 $ hg debugrevlogindex b.txt
536 $ hg debugrevlogindex b.txt
537 rev linkrev nodeid p1 p2
537 rev linkrev nodeid p1 p2
538 0 2 05b806ebe5ea 000000000000 000000000000
538 0 2 05b806ebe5ea 000000000000 000000000000
539 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
539 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
540 2 6 216a5fe8b8ed 000000000000 000000000000
540 2 6 216a5fe8b8ed 000000000000 000000000000
541 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
541 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
542
542
543 $ hg debugrevlogindex D.txt
543 $ hg debugrevlogindex D.txt
544 rev linkrev nodeid p1 p2
544 rev linkrev nodeid p1 p2
545 0 6 2a8d3833f2fb 000000000000 000000000000
545 0 6 2a8d3833f2fb 000000000000 000000000000
546 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
546 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
547
547
548 That we do see the symptoms of the bug
548 That we do see the symptoms of the bug
549
549
550 $ hg up -- -1
550 $ hg up -- -1
551 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
551 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
552 $ hg status
552 $ hg status
553 M D.txt (?)
553 M D.txt (?)
554 M b.txt (?)
554 M b.txt (?)
555
555
556 And that the repair command find issue to fix.
556 And that the repair command find issue to fix.
557
557
558 $ hg debug-repair-issue6528 --dry-run
558 $ hg debug-repair-issue6528 --dry-run
559 found affected revision 1 for filelog 'data/D.txt.i'
559 found affected revision 1 for filelog 'data/D.txt.i'
560 found affected revision 1 for filelog 'data/b.txt.i'
560 found affected revision 1 for filelog 'data/b.txt.i'
561 found affected revision 3 for filelog 'data/b.txt.i'
561 found affected revision 3 for filelog 'data/b.txt.i'
562
562
563 $ cd ..
563 $ cd ..
564
564
565 from a v2 bundle
565 from a v2 bundle
566 ~~~~~~~~~~~~~~~~
566 ~~~~~~~~~~~~~~~~
567
567
568 $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v2
568 $ hg debugbundle --spec "$TESTDIR"/bundles/issue6528.hg-v2
569 bzip2-v2
569 bzip2-v2
570
570
571 $ hg init unbundle-v2-no-fix
571 $ hg init unbundle-v2-no-fix
572 $ cd unbundle-v2-no-fix
572 $ cd unbundle-v2-no-fix
573
573
574 $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v2 --config storage.revlog.issue6528.fix-incoming=no
574 $ hg unbundle "$TESTDIR"/bundles/issue6528.hg-v2 --config storage.revlog.issue6528.fix-incoming=no
575 adding changesets
575 adding changesets
576 adding manifests
576 adding manifests
577 adding file changes
577 adding file changes
578 added 8 changesets with 12 changes to 4 files
578 added 8 changesets with 12 changes to 4 files
579 new changesets f5a5a568022f:3beabb508514 (8 drafts)
579 new changesets f5a5a568022f:3beabb508514 (8 drafts)
580 (run 'hg update' to get a working copy)
580 (run 'hg update' to get a working copy)
581
581
582 Check that revision were not fixed on the fly
582 Check that revision were not fixed on the fly
583
583
584 $ hg debugrevlogindex b.txt
584 $ hg debugrevlogindex b.txt
585 rev linkrev nodeid p1 p2
585 rev linkrev nodeid p1 p2
586 0 2 05b806ebe5ea 000000000000 000000000000
586 0 2 05b806ebe5ea 000000000000 000000000000
587 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
587 1 3 a58b36ad6b65 05b806ebe5ea 000000000000
588 2 6 216a5fe8b8ed 000000000000 000000000000
588 2 6 216a5fe8b8ed 000000000000 000000000000
589 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
589 3 7 ea4f2f2463cc 216a5fe8b8ed 000000000000
590
590
591 $ hg debugrevlogindex D.txt
591 $ hg debugrevlogindex D.txt
592 rev linkrev nodeid p1 p2
592 rev linkrev nodeid p1 p2
593 0 6 2a8d3833f2fb 000000000000 000000000000
593 0 6 2a8d3833f2fb 000000000000 000000000000
594 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
594 1 7 2a80419dfc31 2a8d3833f2fb 000000000000
595
595
596 That we do see the symptoms of the bug
596 That we do see the symptoms of the bug
597
597
598 $ hg up -- -1
598 $ hg up -- -1
599 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
599 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
600 $ hg status
600 $ hg status
601 M D.txt (?)
601 M D.txt (?)
602 M b.txt (?)
602 M b.txt (?)
603
603
604 And that the repair command find issue to fix.
604 And that the repair command find issue to fix.
605
605
606 $ hg debug-repair-issue6528 --dry-run
606 $ hg debug-repair-issue6528 --dry-run
607 found affected revision 1 for filelog 'data/D.txt.i'
607 found affected revision 1 for filelog 'data/D.txt.i'
608 found affected revision 1 for filelog 'data/b.txt.i'
608 found affected revision 1 for filelog 'data/b.txt.i'
609 found affected revision 3 for filelog 'data/b.txt.i'
609 found affected revision 3 for filelog 'data/b.txt.i'
610
610
611 $ cd ..
611 $ cd ..
@@ -1,89 +1,89 b''
1 $ hg init empty-repo
1 $ hg init empty-repo
2 $ cd empty-repo
2 $ cd empty-repo
3
3
4 Flags on revlog version 0 are rejected
4 Flags on revlog version 0 are rejected
5
5
6 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
6 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
7 ... fh.write(b'\x00\x01\x00\x00') and None
7 ... fh.write(b'\x00\x01\x00\x00') and None
8
8
9 $ hg log
9 $ hg log
10 abort: unknown flags (0x01) in version 0 revlog 00changelog
10 abort: unknown flags (0x01) in version 0 revlog 00changelog
11 [50]
11 [50]
12
12
13 Unknown flags on revlog version 1 are rejected
13 Unknown flags on revlog version 1 are rejected
14
14
15 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
15 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
16 ... fh.write(b'\x00\x04\x00\x01') and None
16 ... fh.write(b'\x00\x04\x00\x01') and None
17
17
18 $ hg log
18 $ hg log
19 abort: unknown flags (0x04) in version 1 revlog 00changelog
19 abort: unknown flags (0x04) in version 1 revlog 00changelog
20 [50]
20 [50]
21
21
22 Unknown version is rejected
22 Unknown version is rejected
23
23
24 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
24 >>> with open('.hg/store/00changelog.i', 'wb') as fh:
25 ... fh.write(b'\x00\x00\xbe\xef') and None
25 ... fh.write(b'\x00\x00\xbe\xef') and None
26
26
27 $ hg log
27 $ hg log
28 abort: unknown version (48879) in revlog 00changelog
28 abort: unknown version (48879) in revlog 00changelog
29 [50]
29 [50]
30
30
31 $ cd ..
31 $ cd ..
32
32
33 Test for CVE-2016-3630
33 Test for CVE-2016-3630
34
34
35 $ mkdir test2; cd test2
35 $ mkdir test2; cd test2
36 $ hg init
36 $ hg init
37
37
38 >>> import codecs
38 >>> import codecs
39 >>> open("a.i", "wb").write(codecs.decode(codecs.decode(
39 >>> open("a.i", "wb").write(codecs.decode(codecs.decode(
40 ... b"""eJxjYGZgZIAAYQYGxhgom+k/FMx8YKx9ZUaKSOyqo4cnuKb8mbqHV5cBCVTMWb1Cwqkhe4Gsg9AD
40 ... b"""eJxjYGZgZIAAYQYGxhgom+k/FMx8YKx9ZUaKSOyqo4cnuKb8mbqHV5cBCVTMWb1Cwqkhe4Gsg9AD
41 ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA==""",
41 ... Joa3dYtcYYYBAQ8Qr4OqZAYRICPTSr5WKd/42rV36d+8/VmrNpv7NP1jQAXrQE4BqQUARngwVA==""",
42 ... "base64"), "zlib")) and None
42 ... "base64"), "zlib")) and None
43
43
44 $ hg debugrevlogindex a.i
44 $ hg debugrevlogindex a.i
45 rev linkrev nodeid p1 p2
45 rev linkrev nodeid p1 p2
46 0 2 99e0332bd498 000000000000 000000000000
46 0 2 99e0332bd498 000000000000 000000000000
47 1 3 6674f57a23d8 99e0332bd498 000000000000
47 1 3 6674f57a23d8 99e0332bd498 000000000000
48
48
49 >>> from mercurial.revlogutils.constants import KIND_OTHER
49 >>> from mercurial.revlogutils.constants import KIND_OTHER
50 >>> from mercurial import revlog, vfs
50 >>> from mercurial import revlog, vfs
51 >>> tvfs = vfs.vfs(b'.')
51 >>> tvfs = vfs.vfs(b'.')
52 >>> tvfs.options = {b'revlogv1': True}
52 >>> tvfs.options = {b'revlogv1': True}
53 >>> rl = revlog.revlog(tvfs, target=(KIND_OTHER, b'test'), radix=b'a')
53 >>> rl = revlog.revlog(tvfs, target=(KIND_OTHER, b'test'), radix=b'a')
54 >>> rl.revision(1)
54 >>> rl.revision(1)
55 mpatchError(*'patch cannot be decoded'*) (glob)
55 mpatchError(*'patch cannot be decoded'*) (glob)
56
56
57 $ cd ..
57 $ cd ..
58
58
59
59
60 Regression test for support for the old repos with strange diff encoding.
60 Regression test for support for the old repos with strange diff encoding.
61 Apparently it used to be possible (maybe it's still possible, but we don't know how)
61 Apparently it used to be possible (maybe it's still possible, but we don't know how)
62 to create commits whose diffs are encoded relative to a nullrev.
62 to create commits whose diffs are encoded relative to a nullrev.
63 This test checks that a repo with that encoding can still be read.
63 This test checks that a repo with that encoding can still be read.
64
64
65 This is what we did to produce the repo in test-revlog-diff-relative-to-nullrev.tar:
65 This is what we did to produce the repo in test-revlog-diff-relative-to-nullrev.tar:
66
66
67 - tweak the code in mercurial/revlogutils/deltas.py to produce such "trivial" deltas:
67 - tweak the code in mercurial/revlogutils/deltas.py to produce such "trivial" deltas:
68 > if deltainfo is None:
68 > if deltainfo is None:
69 > - deltainfo = self._fullsnapshotinfo(fh, revinfo, target_rev)
69 > - deltainfo = self._fullsnapshotinfo(fh, revinfo, target_rev)
70 > + deltainfo = self._builddeltainfo(revinfo, nullrev, fh)
70 > + deltainfo = self._builddeltainfo(revinfo, nullrev, fh)
71 - hg init
71 - hg init
72 - echo hi > a
72 - echo hi > a
73 - hg commit -Am_
73 - hg commit -Am_
74 - remove some cache files
74 - remove some cache files
75
75
76 $ tar -x < "$TESTDIR"/bundles/test-revlog-diff-relative-to-nullrev.tar
76 $ tar -xf - < "$TESTDIR"/bundles/test-revlog-diff-relative-to-nullrev.tar
77 $ cd nullrev-diff
77 $ cd nullrev-diff
78 $ hg debugdeltachain a
78 $ hg debugdeltachain a
79 rev p1 p2 chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
79 rev p1 p2 chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
80 0 -1 -1 1 2 -1 p1 15 3 15 5.00000 15 0 0.00000 15 15 1.00000 1
80 0 -1 -1 1 2 -1 p1 15 3 15 5.00000 15 0 0.00000 15 15 1.00000 1
81 1 0 -1 1 2 -1 p2 15 3 15 5.00000 30 15 1.00000 30 30 0.50000 1
81 1 0 -1 1 2 -1 p2 15 3 15 5.00000 30 15 1.00000 30 30 0.50000 1
82 2 -1 -1 1 2 -1 p1 15 3 15 5.00000 45 30 2.00000 45 45 0.33333 1
82 2 -1 -1 1 2 -1 p1 15 3 15 5.00000 45 30 2.00000 45 45 0.33333 1
83 $ hg cat --config rhg.cat=true -r 0 a
83 $ hg cat --config rhg.cat=true -r 0 a
84 hi
84 hi
85 $ hg cat --config rhg.cat=true -r 1 a
85 $ hg cat --config rhg.cat=true -r 1 a
86 ho
86 ho
87 $ hg cat --config rhg.cat=true -r 2 a
87 $ hg cat --config rhg.cat=true -r 2 a
88 ha
88 ha
89 $ cd ..
89 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now