Show More
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,307 b'' | |||
|
1 | ====================================================== | |
|
2 | Test operation on repository with an inlined changelog | |
|
3 | ====================================================== | |
|
4 | ||
|
5 | Inlined revlog has been a bag of complexity for a long time and the combination | |
|
6 | with special transaction logic on the changelog was a long source of bugs | |
|
7 | poorly covered by the test suites. | |
|
8 | ||
|
9 | We stopped doing any usage of inlined-revlog for changelog in a93e52f0b6ff, | |
|
10 | upgrading legacy inlined version as soon as possible when we see them. However | |
|
11 | this Mercurial does not produce such inlined-changelog that case is very poorly | |
|
12 | covered in the test suites. This test file aims at covering these cases. | |
|
13 | ||
|
14 | Double checking test data | |
|
15 | ========================= | |
|
16 | ||
|
17 | We should have a repository around | |
|
18 | ||
|
19 | $ mkdir sanity-check | |
|
20 | $ cd sanity-check | |
|
21 | $ tar xf $TESTDIR/bundles/inlined-changelog.tar | |
|
22 | $ cd inlined-changelog | |
|
23 | $ hg root | |
|
24 | $TESTTMP/sanity-check/inlined-changelog | |
|
25 | ||
|
26 | The repository should not be corrupted initially | |
|
27 | ||
|
28 | $ hg verify | |
|
29 | checking changesets | |
|
30 | checking manifests | |
|
31 | crosschecking files in changesets and manifests | |
|
32 | checking files | |
|
33 | checking dirstate | |
|
34 | checked 1 changesets with 1 changes to 1 files | |
|
35 | ||
|
36 | The changelog of that repository MUST be inlined | |
|
37 | ||
|
38 | $ hg debugrevlog -c | grep -E '^flags\b' | |
|
39 | flags : inline | |
|
40 | ||
|
41 | Touching that repository MUST split that inlined changelog | |
|
42 | ||
|
43 | $ hg branch foo --quiet | |
|
44 | $ hg commit -m foo --quiet | |
|
45 | $ hg debugrevlog -c | grep -E '^flags\b' | |
|
46 | flags : (none) | |
|
47 | ||
|
48 | $ cd ../.. | |
|
49 | ||
|
50 | Test doing a simple commit | |
|
51 | ========================== | |
|
52 | ||
|
53 | Simple commit | |
|
54 | ------------- | |
|
55 | ||
|
56 | $ mkdir simple-commit | |
|
57 | $ cd simple-commit | |
|
58 | $ tar xf $TESTDIR/bundles/inlined-changelog.tar | |
|
59 | $ cd inlined-changelog | |
|
60 | $ hg up --quiet | |
|
61 | $ hg log -GT '[{rev}] {desc}\n' | |
|
62 | @ [0] first commit | |
|
63 | ||
|
64 | $ echo b > b | |
|
65 | $ hg add b | |
|
66 | $ hg commit -m "second changeset" | |
|
67 | $ hg verify | |
|
68 | checking changesets | |
|
69 | checking manifests | |
|
70 | crosschecking files in changesets and manifests | |
|
71 | checking files | |
|
72 | checking dirstate | |
|
73 | checked 2 changesets with 2 changes to 2 files | |
|
74 | $ hg log -GT '[{rev}] {desc}\n' | |
|
75 | @ [1] second changeset | |
|
76 | | | |
|
77 | o [0] first commit | |
|
78 | ||
|
79 | $ cd ../.. | |
|
80 | ||
|
81 | Simple commit with a pretxn hook configured | |
|
82 | ------------------------------------------- | |
|
83 | ||
|
84 | Before 6.7.3 this used to delete the changelog index | |
|
85 | ||
|
86 | $ mkdir pretxnclose-commit | |
|
87 | $ cd pretxnclose-commit | |
|
88 | $ tar xf $TESTDIR/bundles/inlined-changelog.tar | |
|
89 | $ cat >> inlined-changelog/.hg/hgrc <<EOF | |
|
90 | > [hooks] | |
|
91 | > pretxnclose=hg log -r tip -T "pre-txn tip rev: {rev}\n" | |
|
92 | > EOF | |
|
93 | $ cd inlined-changelog | |
|
94 | $ hg up --quiet | |
|
95 | $ hg log -GT '[{rev}] {desc}\n' | |
|
96 | @ [0] first commit | |
|
97 | ||
|
98 | $ echo b > b | |
|
99 | $ hg add b | |
|
100 | $ hg commit -m "second changeset" | |
|
101 | pre-txn tip rev: 1 (missing-correct-output !) | |
|
102 | warning: ignoring unknown working parent 11b63e930bf2! (known-bad-output !) | |
|
103 | pre-txn tip rev: 0 (known-bad-output !) | |
|
104 | $ hg verify | |
|
105 | checking changesets | |
|
106 | checking manifests | |
|
107 | crosschecking files in changesets and manifests | |
|
108 | checking files | |
|
109 | checking dirstate | |
|
110 | checked 2 changesets with 2 changes to 2 files | |
|
111 | $ hg log -GT '[{rev}] {desc}\n' | |
|
112 | @ [1] second changeset | |
|
113 | | | |
|
114 | o [0] first commit | |
|
115 | ||
|
116 | $ cd ../.. | |
|
117 | ||
|
118 | Test pushing to a repository with a repository revlog | |
|
119 | ===================================================== | |
|
120 | ||
|
121 | Simple local push | |
|
122 | ----------------- | |
|
123 | ||
|
124 | $ mkdir simple-local-push | |
|
125 | $ cd simple-local-push | |
|
126 | $ tar xf $TESTDIR/bundles/inlined-changelog.tar | |
|
127 | $ hg log -R inlined-changelog -T '[{rev}] {desc}\n' | |
|
128 | [0] first commit | |
|
129 | ||
|
130 | $ hg clone --pull inlined-changelog client | |
|
131 | requesting all changes | |
|
132 | adding changesets | |
|
133 | adding manifests | |
|
134 | adding file changes | |
|
135 | added 1 changesets with 1 changes to 1 files | |
|
136 | new changesets 827f11bfd362 | |
|
137 | updating to branch default | |
|
138 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
139 | $ cd client | |
|
140 | $ echo b > b | |
|
141 | $ hg add b | |
|
142 | $ hg commit -m "second changeset" | |
|
143 | $ hg push | |
|
144 | pushing to $TESTTMP/*/inlined-changelog (glob) | |
|
145 | searching for changes | |
|
146 | adding changesets | |
|
147 | adding manifests | |
|
148 | adding file changes | |
|
149 | added 1 changesets with 1 changes to 1 files | |
|
150 | $ cd .. | |
|
151 | ||
|
152 | $ hg verify -R inlined-changelog | |
|
153 | checking changesets | |
|
154 | checking manifests | |
|
155 | crosschecking files in changesets and manifests | |
|
156 | checking files | |
|
157 | checking dirstate | |
|
158 | checked 2 changesets with 2 changes to 2 files | |
|
159 | $ hg log -R inlined-changelog -T '[{rev}] {desc}\n' | |
|
160 | [1] second changeset | |
|
161 | [0] first commit | |
|
162 | $ cd .. | |
|
163 | ||
|
164 | Simple local push with a pretxnchangegroup hook | |
|
165 | ----------------------------------------------- | |
|
166 | ||
|
167 | Before 6.7.3 this used to delete the server changelog | |
|
168 | ||
|
169 | $ mkdir pretxnchangegroup-local-push | |
|
170 | $ cd pretxnchangegroup-local-push | |
|
171 | $ tar xf $TESTDIR/bundles/inlined-changelog.tar | |
|
172 | $ cat >> inlined-changelog/.hg/hgrc <<EOF | |
|
173 | > [hooks] | |
|
174 | > pretxnchangegroup=hg log -r tip -T "pre-txn tip rev: {rev}\n" | |
|
175 | > EOF | |
|
176 | $ hg log -R inlined-changelog -T '[{rev}] {desc}\n' | |
|
177 | [0] first commit | |
|
178 | ||
|
179 | $ hg clone --pull inlined-changelog client | |
|
180 | requesting all changes | |
|
181 | adding changesets | |
|
182 | adding manifests | |
|
183 | adding file changes | |
|
184 | added 1 changesets with 1 changes to 1 files | |
|
185 | new changesets 827f11bfd362 | |
|
186 | updating to branch default | |
|
187 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
188 | $ cd client | |
|
189 | $ echo b > b | |
|
190 | $ hg add b | |
|
191 | $ hg commit -m "second changeset" | |
|
192 | $ hg push | |
|
193 | pushing to $TESTTMP/*/inlined-changelog (glob) | |
|
194 | searching for changes | |
|
195 | adding changesets | |
|
196 | adding manifests | |
|
197 | adding file changes | |
|
198 | pre-txn tip rev: 1 (missing-correct-output !) | |
|
199 | pre-txn tip rev: 0 (known-bad-output !) | |
|
200 | added 1 changesets with 1 changes to 1 files | |
|
201 | $ cd .. | |
|
202 | ||
|
203 | $ hg verify -R inlined-changelog | |
|
204 | checking changesets | |
|
205 | checking manifests | |
|
206 | crosschecking files in changesets and manifests | |
|
207 | checking files | |
|
208 | checking dirstate | |
|
209 | checked 2 changesets with 2 changes to 2 files | |
|
210 | $ hg log -R inlined-changelog -T '[{rev}] {desc}\n' | |
|
211 | [1] second changeset | |
|
212 | [0] first commit | |
|
213 | $ cd .. | |
|
214 | ||
|
215 | Simple ssh push | |
|
216 | ----------------- | |
|
217 | ||
|
218 | $ mkdir simple-ssh-push | |
|
219 | $ cd simple-ssh-push | |
|
220 | $ tar xf $TESTDIR/bundles/inlined-changelog.tar | |
|
221 | $ hg log -R inlined-changelog -T '[{rev}] {desc}\n' | |
|
222 | [0] first commit | |
|
223 | ||
|
224 | $ hg clone ssh://user@dummy/"`pwd`"/inlined-changelog client | |
|
225 | requesting all changes | |
|
226 | adding changesets | |
|
227 | adding manifests | |
|
228 | adding file changes | |
|
229 | added 1 changesets with 1 changes to 1 files | |
|
230 | new changesets 827f11bfd362 | |
|
231 | updating to branch default | |
|
232 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
233 | $ cd client | |
|
234 | $ echo b > b | |
|
235 | $ hg add b | |
|
236 | $ hg commit -m "second changeset" | |
|
237 | $ hg push | |
|
238 | pushing to ssh://user@dummy/$TESTTMP/simple-ssh-push/inlined-changelog | |
|
239 | searching for changes | |
|
240 | remote: adding changesets | |
|
241 | remote: adding manifests | |
|
242 | remote: adding file changes | |
|
243 | remote: added 1 changesets with 1 changes to 1 files | |
|
244 | $ cd .. | |
|
245 | ||
|
246 | $ hg verify -R inlined-changelog | |
|
247 | checking changesets | |
|
248 | checking manifests | |
|
249 | crosschecking files in changesets and manifests | |
|
250 | checking files | |
|
251 | checking dirstate | |
|
252 | checked 2 changesets with 2 changes to 2 files | |
|
253 | $ hg log -R inlined-changelog -T '[{rev}] {desc}\n' | |
|
254 | [1] second changeset | |
|
255 | [0] first commit | |
|
256 | $ cd .. | |
|
257 | ||
|
258 | Simple ssh push with a pretxnchangegroup hook | |
|
259 | ----------------------------------------------- | |
|
260 | ||
|
261 | Before 6.7.3 this used to delete the server changelog | |
|
262 | ||
|
263 | $ mkdir pretxnchangegroup-ssh-push | |
|
264 | $ cd pretxnchangegroup-ssh-push | |
|
265 | $ tar xf $TESTDIR/bundles/inlined-changelog.tar | |
|
266 | $ cat >> inlined-changelog/.hg/hgrc <<EOF | |
|
267 | > [hooks] | |
|
268 | > pretxnchangegroup=hg log -r tip -T "pre-txn tip rev: {rev}\n" | |
|
269 | > EOF | |
|
270 | $ hg log -R inlined-changelog -T '[{rev}] {desc}\n' | |
|
271 | [0] first commit | |
|
272 | ||
|
273 | $ hg clone ssh://user@dummy/"`pwd`"/inlined-changelog client | |
|
274 | requesting all changes | |
|
275 | adding changesets | |
|
276 | adding manifests | |
|
277 | adding file changes | |
|
278 | added 1 changesets with 1 changes to 1 files | |
|
279 | new changesets 827f11bfd362 | |
|
280 | updating to branch default | |
|
281 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
282 | $ cd client | |
|
283 | $ echo b > b | |
|
284 | $ hg add b | |
|
285 | $ hg commit -m "second changeset" | |
|
286 | $ hg push | |
|
287 | pushing to ssh://user@dummy/$TESTTMP/pretxnchangegroup-ssh-push/inlined-changelog | |
|
288 | searching for changes | |
|
289 | remote: adding changesets | |
|
290 | remote: adding manifests | |
|
291 | remote: adding file changes | |
|
292 | remote: pre-txn tip rev: 1 (missing-correct-output !) | |
|
293 | remote: pre-txn tip rev: 0 (known-bad-output !) | |
|
294 | remote: added 1 changesets with 1 changes to 1 files | |
|
295 | $ cd .. | |
|
296 | ||
|
297 | $ hg verify -R inlined-changelog | |
|
298 | checking changesets | |
|
299 | checking manifests | |
|
300 | crosschecking files in changesets and manifests | |
|
301 | checking files | |
|
302 | checking dirstate | |
|
303 | checked 2 changesets with 2 changes to 2 files | |
|
304 | $ hg log -R inlined-changelog -T '[{rev}] {desc}\n' | |
|
305 | [1] second changeset | |
|
306 | [0] first commit | |
|
307 | $ cd .. |
@@ -357,8 +357,10 b' class changelog(revlog.revlog):' | |||
|
357 | 357 | if new_index is not None: |
|
358 | 358 | self._indexfile = new_index |
|
359 | 359 | tr.registertmp(new_index) |
|
360 | tr.addpending(b'cl-%i' % id(self), self._writepending) | |
|
361 | tr.addfinalize(b'cl-%i' % id(self), self._finalize) | |
|
360 | # use "000" as prefix to make sure we run before the spliting of legacy | |
|
361 | # inline changelog.. | |
|
362 | tr.addpending(b'000-cl-%i' % id(self), self._writepending) | |
|
363 | tr.addfinalize(b'000-cl-%i' % id(self), self._finalize) | |
|
362 | 364 | |
|
363 | 365 | def _finalize(self, tr): |
|
364 | 366 | """finalize index updates""" |
@@ -2895,10 +2895,13 b' class revlog:' | |||
|
2895 | 2895 | maybe_self._inner.index_file = old_index_file_path |
|
2896 | 2896 | |
|
2897 | 2897 | tr.registertmp(new_index_file_path) |
|
2898 | # we use 001 here to make this this happens after the finalisation of | |
|
2899 | # pending changelog write (using 000). Otherwise the two finalizer | |
|
2900 | # would step over each other and delete the changelog.i file. | |
|
2898 | 2901 | if self.target[1] is not None: |
|
2899 |
callback_id = b'00 |
|
|
2902 | callback_id = b'001-revlog-split-%d-%s' % self.target | |
|
2900 | 2903 | else: |
|
2901 |
callback_id = b'00 |
|
|
2904 | callback_id = b'001-revlog-split-%d' % self.target[0] | |
|
2902 | 2905 | tr.addfinalize(callback_id, finalize_callback) |
|
2903 | 2906 | tr.addabort(callback_id, abort_callback) |
|
2904 | 2907 |
@@ -1082,9 +1082,9 b' ensure changelog is written before bookm' | |||
|
1082 | 1082 | > time.sleep(0.5) |
|
1083 | 1083 | > if os.path.exists(b"$TESTTMP/unpause"): |
|
1084 | 1084 | > os.remove(b"$TESTTMP/unpause") |
|
1085 |
> # It is important that this finalizer start with 'a', so it runs |
|
|
1086 | > # the changelog finalizer appends to the changelog. | |
|
1087 | > tr.addfinalize(b'a-sleep', sleep) | |
|
1085 | > # It is important that this finalizer start with '000-a', so it runs | |
|
1086 | > # before the changelog finalizer appends to the changelog. | |
|
1087 | > tr.addfinalize(b'000-a-sleep', sleep) | |
|
1088 | 1088 | > return tr |
|
1089 | 1089 | > |
|
1090 | 1090 | > def extsetup(ui): |
General Comments 0
You need to be logged in to leave comments.
Login now