##// END OF EJS Templates
copies-sdc: no longer use revlogv2 in `test-copies-in-changeset.t`...
marmoute -
r50079:eb5954f0 default
parent child Browse files
Show More
@@ -1,472 +1,470 b''
1 1 #testcases extra sidedata
2 2
3 3 #if extra
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [experimental]
6 6 > copies.write-to=changeset-only
7 7 > copies.read-from=changeset-only
8 8 > [alias]
9 9 > changesetcopies = log -r . -T 'files: {files}
10 10 > {extras % "{ifcontains("files", key, "{key}: {value}\n")}"}
11 11 > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}'
12 12 > EOF
13 13 #endif
14 14
15 15 #if sidedata
16 16 $ cat >> $HGRCPATH << EOF
17 17 > [format]
18 18 > exp-use-copies-side-data-changeset = yes
19 19 > EOF
20 20 #endif
21 21
22 22 $ cat >> $HGRCPATH << EOF
23 23 > [alias]
24 24 > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
25 25 > [extensions]
26 26 > rebase =
27 27 > split =
28 28 > EOF
29 29
30 30 Check that copies are recorded correctly
31 31
32 32 $ hg init repo
33 33 $ cd repo
34 34 #if sidedata
35 35 $ hg debugformat -v | egrep 'format-variant|revlog-v2|copies-sdc|changelog-v2'
36 36 format-variant repo config default
37 37 copies-sdc: yes yes no
38 38 revlog-v2: no no no
39 39 changelog-v2: yes yes no
40 40 #else
41 41 $ hg debugformat -v | egrep 'format-variant|revlog-v2|copies-sdc|changelog-v2'
42 42 format-variant repo config default
43 43 copies-sdc: no no no
44 44 revlog-v2: no no no
45 45 changelog-v2: no no no
46 46 #endif
47 47 $ echo a > a
48 48 $ hg add a
49 49 $ hg ci -m initial
50 50 $ hg cp a b
51 51 $ hg cp a c
52 52 $ hg cp a d
53 53 $ hg ci -m 'copy a to b, c, and d'
54 54
55 55 #if extra
56 56
57 57 $ hg changesetcopies
58 58 files: b c d
59 59 filesadded: 0
60 60 1
61 61 2
62 62
63 63 p1copies: 0\x00a (esc)
64 64 1\x00a (esc)
65 65 2\x00a (esc)
66 66 #else
67 67 $ hg debugsidedata -c -v -- -1
68 68 1 sidedata entries
69 69 entry-0014 size 44
70 70 '\x00\x00\x00\x04\x00\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00\x06\x00\x00\x00\x03\x00\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00\x00abcd'
71 71 #endif
72 72
73 73 $ hg showcopies
74 74 a -> b
75 75 a -> c
76 76 a -> d
77 77
78 78 #if extra
79 79
80 80 $ hg showcopies --config experimental.copies.read-from=compatibility
81 81 a -> b
82 82 a -> c
83 83 a -> d
84 84 $ hg showcopies --config experimental.copies.read-from=filelog-only
85 85
86 86 #endif
87 87
88 88 Check that renames are recorded correctly
89 89
90 90 $ hg mv b b2
91 91 $ hg ci -m 'rename b to b2'
92 92
93 93 #if extra
94 94
95 95 $ hg changesetcopies
96 96 files: b b2
97 97 filesadded: 1
98 98 filesremoved: 0
99 99
100 100 p1copies: 1\x00b (esc)
101 101
102 102 #else
103 103 $ hg debugsidedata -c -v -- -1
104 104 1 sidedata entries
105 105 entry-0014 size 25
106 106 '\x00\x00\x00\x02\x0c\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x03\x00\x00\x00\x00bb2'
107 107 #endif
108 108
109 109 $ hg showcopies
110 110 b -> b2
111 111
112 112
113 113 Rename onto existing file. This should get recorded in the changeset files list and in the extras,
114 114 even though there is no filelog entry.
115 115
116 116 $ hg cp b2 c --force
117 117 $ hg st --copies
118 118 M c
119 119 b2
120 120
121 121 #if extra
122 122
123 123 $ hg debugindex c
124 124 rev linkrev nodeid p1 p2
125 125 0 1 b789fdd96dc2 000000000000 000000000000
126 126
127 127 #else
128 128
129 129 $ hg debugindex c
130 130 rev linkrev nodeid p1 p2
131 131 0 1 37d9b5d994ea 000000000000 000000000000
132 132
133 133 #endif
134 134
135 135
136 136 $ hg ci -m 'move b onto d'
137 137
138 138 #if extra
139 139
140 140 $ hg changesetcopies
141 141 files: c
142 142
143 143 p1copies: 0\x00b2 (esc)
144 144
145 145 #else
146 146 $ hg debugsidedata -c -v -- -1
147 147 1 sidedata entries
148 148 entry-0014 size 25
149 149 '\x00\x00\x00\x02\x00\x00\x00\x00\x02\x00\x00\x00\x00\x16\x00\x00\x00\x03\x00\x00\x00\x00b2c'
150 150 #endif
151 151
152 152 $ hg showcopies
153 153 b2 -> c
154 154
155 155 #if extra
156 156
157 157 $ hg debugindex c
158 158 rev linkrev nodeid p1 p2
159 159 0 1 b789fdd96dc2 000000000000 000000000000
160 160
161 161 #else
162 162
163 163 $ hg debugindex c
164 164 rev linkrev nodeid p1 p2
165 165 0 1 37d9b5d994ea 000000000000 000000000000
166 166 1 3 029625640347 000000000000 000000000000
167 167
168 168 #endif
169 169
170 170 Create a merge commit with copying done during merge.
171 171
172 172 $ hg co 0
173 173 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
174 174 $ hg cp a e
175 175 $ hg cp a f
176 176 $ hg ci -m 'copy a to e and f'
177 177 created new head
178 178 $ hg merge 3
179 179 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
180 180 (branch merge, don't forget to commit)
181 181 File 'a' exists on both sides, so 'g' could be recorded as being from p1 or p2, but we currently
182 182 always record it as being from p1
183 183 $ hg cp a g
184 184 File 'd' exists only in p2, so 'h' should be from p2
185 185 $ hg cp d h
186 186 File 'f' exists only in p1, so 'i' should be from p1
187 187 $ hg cp f i
188 188 $ hg ci -m 'merge'
189 189
190 190 #if extra
191 191
192 192 $ hg changesetcopies
193 193 files: g h i
194 194 filesadded: 0
195 195 1
196 196 2
197 197
198 198 p1copies: 0\x00a (esc)
199 199 2\x00f (esc)
200 200 p2copies: 1\x00d (esc)
201 201
202 202 #else
203 203 $ hg debugsidedata -c -v -- -1
204 204 1 sidedata entries
205 205 entry-0014 size 64
206 206 '\x00\x00\x00\x06\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x06\x00\x00\x00\x04\x00\x00\x00\x00\x07\x00\x00\x00\x05\x00\x00\x00\x01\x06\x00\x00\x00\x06\x00\x00\x00\x02adfghi'
207 207 #endif
208 208
209 209 $ hg showcopies
210 210 a -> g
211 211 d -> h
212 212 f -> i
213 213
214 214 Test writing to both changeset and filelog
215 215
216 216 $ hg cp a j
217 217 #if extra
218 218 $ hg ci -m 'copy a to j' --config experimental.copies.write-to=compatibility
219 219 $ hg changesetcopies
220 220 files: j
221 221 filesadded: 0
222 222 filesremoved:
223 223
224 224 p1copies: 0\x00a (esc)
225 225 p2copies:
226 226 #else
227 227 $ hg ci -m 'copy a to j'
228 228 $ hg debugsidedata -c -v -- -1
229 229 1 sidedata entries
230 230 entry-0014 size 24
231 231 '\x00\x00\x00\x02\x00\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00aj'
232 232 #endif
233 233 $ hg debugdata j 0
234 234 \x01 (esc)
235 235 copy: a
236 236 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
237 237 \x01 (esc)
238 238 a
239 239 $ hg showcopies
240 240 a -> j
241 241 $ hg showcopies --config experimental.copies.read-from=compatibility
242 242 a -> j
243 243 $ hg showcopies --config experimental.copies.read-from=filelog-only
244 244 a -> j
245 245 Existing copy information in the changeset gets removed on amend and writing
246 246 copy information on to the filelog
247 247 #if extra
248 248 $ hg ci --amend -m 'copy a to j, v2' \
249 249 > --config experimental.copies.write-to=filelog-only
250 250 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
251 251 $ hg changesetcopies
252 252 files: j
253 253
254 254 #else
255 255 $ hg ci --amend -m 'copy a to j, v2'
256 256 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
257 257 $ hg debugsidedata -c -v -- -1
258 258 1 sidedata entries
259 259 entry-0014 size 24
260 260 '\x00\x00\x00\x02\x00\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00aj'
261 261 #endif
262 262 $ hg showcopies --config experimental.copies.read-from=filelog-only
263 263 a -> j
264 264 The entries should be written to extras even if they're empty (so the client
265 265 won't have to fall back to reading from filelogs)
266 266 $ echo x >> j
267 267 #if extra
268 268 $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility
269 269 $ hg changesetcopies
270 270 files: j
271 271 filesadded:
272 272 filesremoved:
273 273
274 274 p1copies:
275 275 p2copies:
276 276 #else
277 277 $ hg ci -m 'modify j'
278 278 $ hg debugsidedata -c -v -- -1
279 279 1 sidedata entries
280 280 entry-0014 size 14
281 281 '\x00\x00\x00\x01\x14\x00\x00\x00\x01\x00\x00\x00\x00j'
282 282 #endif
283 283
284 284 Test writing only to filelog
285 285
286 286 $ hg cp a k
287 287 #if extra
288 288 $ hg ci -m 'copy a to k' --config experimental.copies.write-to=filelog-only
289 289
290 290 $ hg changesetcopies
291 291 files: k
292 292
293 293 #else
294 294 $ hg ci -m 'copy a to k'
295 295 $ hg debugsidedata -c -v -- -1
296 296 1 sidedata entries
297 297 entry-0014 size 24
298 298 '\x00\x00\x00\x02\x00\x00\x00\x00\x01\x00\x00\x00\x00\x06\x00\x00\x00\x02\x00\x00\x00\x00ak'
299 299 #endif
300 300
301 301 $ hg debugdata k 0
302 302 \x01 (esc)
303 303 copy: a
304 304 copyrev: b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
305 305 \x01 (esc)
306 306 a
307 307 #if extra
308 308 $ hg showcopies
309 309
310 310 $ hg showcopies --config experimental.copies.read-from=compatibility
311 311 a -> k
312 312 $ hg showcopies --config experimental.copies.read-from=filelog-only
313 313 a -> k
314 314 #else
315 315 $ hg showcopies
316 316 a -> k
317 317 #endif
318 318
319 319 Existing copy information is preserved by amend
320 320 $ hg cp a l
321 321 $ hg ci -m 'copy a to l'
322 322 $ hg showcopies
323 323 a -> l
324 324 $ hg ci --amend -m 'new description'
325 325 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
326 326 $ hg showcopies
327 327 a -> l
328 328
329 329 No crash on partial amend
330 330 $ hg st --change .
331 331 A l
332 332 $ echo modified >> a
333 333 $ hg rm l
334 334 $ hg commit --amend a
335 335 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-*-amend.hg (glob)
336 336
337 337 $ cd ..
338 338
339 339 Test rebasing a commit with copy information
340 340
341 341 $ hg init rebase-rename
342 342 $ cd rebase-rename
343 343 $ echo a > a
344 344 $ hg ci -Aqm 'add a'
345 345 $ echo a2 > a
346 346 $ hg ci -m 'modify a'
347 347 $ hg co -q 0
348 348 $ hg mv a b
349 349 $ hg ci -qm 'rename a to b'
350 350 Not only do we want this to run in-memory, it shouldn't fall back to
351 351 on-disk merge (no conflicts), so we force it to be in-memory
352 352 with no fallback.
353 353 $ hg rebase -d 1 --config rebase.experimental.inmemory=yes --config devel.rebase.force-in-memory-merge=yes
354 354 rebasing 2:* tip "rename a to b" (glob)
355 355 merging a and b to b
356 356 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/*-*-rebase.hg (glob)
357 357 $ hg st --change . --copies
358 358 A b
359 359 a
360 360 R a
361 361 $ cd ..
362 362
363 363 Test splitting a commit
364 364
365 365 $ hg init split
366 366 $ cd split
367 367 $ echo a > a
368 368 $ echo b > b
369 369 $ hg ci -Aqm 'add a and b'
370 370 $ echo a2 > a
371 371 $ hg mv b c
372 372 $ hg ci -m 'modify a, move b to c'
373 373 $ hg --config ui.interactive=yes split <<EOF
374 374 > y
375 375 > y
376 376 > n
377 377 > y
378 378 > EOF
379 379 diff --git a/a b/a
380 380 1 hunks, 1 lines changed
381 381 examine changes to 'a'?
382 382 (enter ? for help) [Ynesfdaq?] y
383 383
384 384 @@ -1,1 +1,1 @@
385 385 -a
386 386 +a2
387 387 record this change to 'a'?
388 388 (enter ? for help) [Ynesfdaq?] y
389 389
390 390 diff --git a/b b/c
391 391 rename from b
392 392 rename to c
393 393 examine changes to 'b' and 'c'?
394 394 (enter ? for help) [Ynesfdaq?] n
395 395
396 396 created new head
397 397 diff --git a/b b/c
398 398 rename from b
399 399 rename to c
400 400 examine changes to 'b' and 'c'?
401 401 (enter ? for help) [Ynesfdaq?] y
402 402
403 403 saved backup bundle to $TESTTMP/split/.hg/strip-backup/*-*-split.hg (glob)
404 404 $ cd ..
405 405
406 406 Test committing half a rename
407 407
408 408 $ hg init partial
409 409 $ cd partial
410 410 $ echo a > a
411 411 $ hg ci -Aqm 'add a'
412 412 $ hg mv a b
413 413 $ hg ci -m 'remove a' a
414 414
415 415 #if sidedata
416 416
417 417 Test upgrading/downgrading to sidedata storage
418 418 ==============================================
419 419
420 420 downgrading
421 421
422 422 $ hg debugformat -v | egrep 'format-variant|revlog-v2|copies-sdc|changelog-v2'
423 423 format-variant repo config default
424 424 copies-sdc: yes yes no
425 425 revlog-v2: no no no
426 426 changelog-v2: yes yes no
427 427 $ hg debugsidedata -c -- 0
428 428 1 sidedata entries
429 429 entry-0014 size 14
430 430 $ hg debugsidedata -c -- 1
431 431 1 sidedata entries
432 432 entry-0014 size 14
433 433 $ hg debugsidedata -m -- 0
434 434 $ cat << EOF > .hg/hgrc
435 435 > [format]
436 436 > exp-use-copies-side-data-changeset = no
437 > [experimental]
438 > revlogv2 = enable-unstable-format-and-corrupt-my-data
439 437 > EOF
440 438 $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
441 439 $ hg debugformat -v | egrep 'format-variant|revlog-v2|copies-sdc|changelog-v2'
442 440 format-variant repo config default
443 441 copies-sdc: no no no
444 revlog-v2: yes yes no
442 revlog-v2: no no no
445 443 changelog-v2: no no no
446 444 $ hg debugsidedata -c -- 0
447 445 $ hg debugsidedata -c -- 1
448 446 $ hg debugsidedata -m -- 0
449 447
450 448 upgrading
451 449
452 450 $ cat << EOF > .hg/hgrc
453 451 > [format]
454 452 > exp-use-copies-side-data-changeset = yes
455 453 > EOF
456 454 $ hg debugupgraderepo --run --quiet --no-backup > /dev/null
457 455 $ hg debugformat -v | egrep 'format-variant|revlog-v2|copies-sdc|changelog-v2'
458 456 format-variant repo config default
459 457 copies-sdc: yes yes no
460 458 revlog-v2: no no no
461 459 changelog-v2: yes yes no
462 460 $ hg debugsidedata -c -- 0
463 461 1 sidedata entries
464 462 entry-0014 size 14
465 463 $ hg debugsidedata -c -- 1
466 464 1 sidedata entries
467 465 entry-0014 size 14
468 466 $ hg debugsidedata -m -- 0
469 467
470 468 #endif
471 469
472 470 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now