##// END OF EJS Templates
tests: change branches test to work cross platform...
timeless -
r28145:cfa00374 default
parent child Browse files
Show More
@@ -1,632 +1,632 b''
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo 'root' >root
4 4 $ hg add root
5 5 $ hg commit -d '0 0' -m "Adding root node"
6 6
7 7 $ echo 'a' >a
8 8 $ hg add a
9 9 $ hg branch a
10 10 marked working directory as branch a
11 11 (branches are permanent and global, did you want a bookmark?)
12 12 $ hg commit -d '1 0' -m "Adding a branch"
13 13
14 14 $ hg branch q
15 15 marked working directory as branch q
16 16 $ echo 'aa' >a
17 17 $ hg branch -C
18 18 reset working directory to branch a
19 19 $ hg commit -d '2 0' -m "Adding to a branch"
20 20
21 21 $ hg update -C 0
22 22 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
23 23 $ echo 'b' >b
24 24 $ hg add b
25 25 $ hg branch b
26 26 marked working directory as branch b
27 27 $ hg commit -d '2 0' -m "Adding b branch"
28 28
29 29 $ echo 'bh1' >bh1
30 30 $ hg add bh1
31 31 $ hg commit -d '3 0' -m "Adding b branch head 1"
32 32
33 33 $ hg update -C 2
34 34 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
35 35 $ echo 'bh2' >bh2
36 36 $ hg add bh2
37 37 $ hg commit -d '4 0' -m "Adding b branch head 2"
38 38
39 39 $ echo 'c' >c
40 40 $ hg add c
41 41 $ hg branch c
42 42 marked working directory as branch c
43 43 $ hg commit -d '5 0' -m "Adding c branch"
44 44
45 45 reserved names
46 46
47 47 $ hg branch tip
48 48 abort: the name 'tip' is reserved
49 49 [255]
50 50 $ hg branch null
51 51 abort: the name 'null' is reserved
52 52 [255]
53 53 $ hg branch .
54 54 abort: the name '.' is reserved
55 55 [255]
56 56
57 57 invalid characters
58 58
59 59 $ hg branch 'foo:bar'
60 60 abort: ':' cannot be used in a name
61 61 [255]
62 62
63 63 $ hg branch 'foo
64 64 > bar'
65 65 abort: '\n' cannot be used in a name
66 66 [255]
67 67
68 68 trailing or leading spaces should be stripped before testing duplicates
69 69
70 70 $ hg branch 'b '
71 71 abort: a branch of the same name already exists
72 72 (use 'hg update' to switch to it)
73 73 [255]
74 74
75 75 $ hg branch ' b'
76 76 abort: a branch of the same name already exists
77 77 (use 'hg update' to switch to it)
78 78 [255]
79 79
80 80 verify update will accept invalid legacy branch names
81 81
82 82 $ hg init test-invalid-branch-name
83 83 $ cd test-invalid-branch-name
84 84 $ hg pull -u "$TESTDIR"/bundles/test-invalid-branch-name.hg
85 85 pulling from *test-invalid-branch-name.hg (glob)
86 86 requesting all changes
87 87 adding changesets
88 88 adding manifests
89 89 adding file changes
90 90 added 3 changesets with 3 changes to 2 files
91 91 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 92
93 93 $ hg update '"colon:test"'
94 94 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
95 95 $ cd ..
96 96
97 97 $ echo 'd' >d
98 98 $ hg add d
99 99 $ hg branch 'a branch name much longer than the default justification used by branches'
100 100 marked working directory as branch a branch name much longer than the default justification used by branches
101 101 $ hg commit -d '6 0' -m "Adding d branch"
102 102
103 103 $ hg branches
104 104 a branch name much longer than the default justification used by branches 7:10ff5895aa57
105 105 b 4:aee39cd168d0
106 106 c 6:589736a22561 (inactive)
107 107 a 5:d8cbc61dbaa6 (inactive)
108 108 default 0:19709c5a4e75 (inactive)
109 109
110 110 -------
111 111
112 112 $ hg branches -a
113 113 a branch name much longer than the default justification used by branches 7:10ff5895aa57
114 114 b 4:aee39cd168d0
115 115
116 116 --- Branch a
117 117
118 118 $ hg log -b a
119 119 changeset: 5:d8cbc61dbaa6
120 120 branch: a
121 121 parent: 2:881fe2b92ad0
122 122 user: test
123 123 date: Thu Jan 01 00:00:04 1970 +0000
124 124 summary: Adding b branch head 2
125 125
126 126 changeset: 2:881fe2b92ad0
127 127 branch: a
128 128 user: test
129 129 date: Thu Jan 01 00:00:02 1970 +0000
130 130 summary: Adding to a branch
131 131
132 132 changeset: 1:dd6b440dd85a
133 133 branch: a
134 134 user: test
135 135 date: Thu Jan 01 00:00:01 1970 +0000
136 136 summary: Adding a branch
137 137
138 138
139 139 ---- Branch b
140 140
141 141 $ hg log -b b
142 142 changeset: 4:aee39cd168d0
143 143 branch: b
144 144 user: test
145 145 date: Thu Jan 01 00:00:03 1970 +0000
146 146 summary: Adding b branch head 1
147 147
148 148 changeset: 3:ac22033332d1
149 149 branch: b
150 150 parent: 0:19709c5a4e75
151 151 user: test
152 152 date: Thu Jan 01 00:00:02 1970 +0000
153 153 summary: Adding b branch
154 154
155 155
156 156 ---- going to test branch closing
157 157
158 158 $ hg branches
159 159 a branch name much longer than the default justification used by branches 7:10ff5895aa57
160 160 b 4:aee39cd168d0
161 161 c 6:589736a22561 (inactive)
162 162 a 5:d8cbc61dbaa6 (inactive)
163 163 default 0:19709c5a4e75 (inactive)
164 164 $ hg up -C b
165 165 2 files updated, 0 files merged, 4 files removed, 0 files unresolved
166 166 $ echo 'xxx1' >> b
167 167 $ hg commit -d '7 0' -m 'adding cset to branch b'
168 168 $ hg up -C aee39cd168d0
169 169 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
170 170 $ echo 'xxx2' >> b
171 171 $ hg commit -d '8 0' -m 'adding head to branch b'
172 172 created new head
173 173 $ echo 'xxx3' >> b
174 174 $ hg commit -d '9 0' -m 'adding another cset to branch b'
175 175 $ hg branches
176 176 b 10:bfbe841b666e
177 177 a branch name much longer than the default justification used by branches 7:10ff5895aa57
178 178 c 6:589736a22561 (inactive)
179 179 a 5:d8cbc61dbaa6 (inactive)
180 180 default 0:19709c5a4e75 (inactive)
181 181 $ hg heads --closed
182 182 changeset: 10:bfbe841b666e
183 183 branch: b
184 184 tag: tip
185 185 user: test
186 186 date: Thu Jan 01 00:00:09 1970 +0000
187 187 summary: adding another cset to branch b
188 188
189 189 changeset: 8:eebb944467c9
190 190 branch: b
191 191 parent: 4:aee39cd168d0
192 192 user: test
193 193 date: Thu Jan 01 00:00:07 1970 +0000
194 194 summary: adding cset to branch b
195 195
196 196 changeset: 7:10ff5895aa57
197 197 branch: a branch name much longer than the default justification used by branches
198 198 user: test
199 199 date: Thu Jan 01 00:00:06 1970 +0000
200 200 summary: Adding d branch
201 201
202 202 changeset: 6:589736a22561
203 203 branch: c
204 204 user: test
205 205 date: Thu Jan 01 00:00:05 1970 +0000
206 206 summary: Adding c branch
207 207
208 208 changeset: 5:d8cbc61dbaa6
209 209 branch: a
210 210 parent: 2:881fe2b92ad0
211 211 user: test
212 212 date: Thu Jan 01 00:00:04 1970 +0000
213 213 summary: Adding b branch head 2
214 214
215 215 changeset: 0:19709c5a4e75
216 216 user: test
217 217 date: Thu Jan 01 00:00:00 1970 +0000
218 218 summary: Adding root node
219 219
220 220 $ hg heads
221 221 changeset: 10:bfbe841b666e
222 222 branch: b
223 223 tag: tip
224 224 user: test
225 225 date: Thu Jan 01 00:00:09 1970 +0000
226 226 summary: adding another cset to branch b
227 227
228 228 changeset: 8:eebb944467c9
229 229 branch: b
230 230 parent: 4:aee39cd168d0
231 231 user: test
232 232 date: Thu Jan 01 00:00:07 1970 +0000
233 233 summary: adding cset to branch b
234 234
235 235 changeset: 7:10ff5895aa57
236 236 branch: a branch name much longer than the default justification used by branches
237 237 user: test
238 238 date: Thu Jan 01 00:00:06 1970 +0000
239 239 summary: Adding d branch
240 240
241 241 changeset: 6:589736a22561
242 242 branch: c
243 243 user: test
244 244 date: Thu Jan 01 00:00:05 1970 +0000
245 245 summary: Adding c branch
246 246
247 247 changeset: 5:d8cbc61dbaa6
248 248 branch: a
249 249 parent: 2:881fe2b92ad0
250 250 user: test
251 251 date: Thu Jan 01 00:00:04 1970 +0000
252 252 summary: Adding b branch head 2
253 253
254 254 changeset: 0:19709c5a4e75
255 255 user: test
256 256 date: Thu Jan 01 00:00:00 1970 +0000
257 257 summary: Adding root node
258 258
259 259 $ hg commit -d '9 0' --close-branch -m 'prune bad branch'
260 260 $ hg branches -a
261 261 b 8:eebb944467c9
262 262 a branch name much longer than the default justification used by branches 7:10ff5895aa57
263 263 $ hg up -C b
264 264 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
265 265 $ hg commit -d '9 0' --close-branch -m 'close this part branch too'
266 266 $ hg commit -d '9 0' --close-branch -m 're-closing this branch'
267 267 abort: can only close branch heads
268 268 [255]
269 269
270 270 $ hg log -r tip --debug
271 271 changeset: 12:e3d49c0575d8fc2cb1cd6859c747c14f5f6d499f
272 272 branch: b
273 273 tag: tip
274 274 phase: draft
275 275 parent: 8:eebb944467c9fb9651ed232aeaf31b3c0a7fc6c1
276 276 parent: -1:0000000000000000000000000000000000000000
277 277 manifest: 8:6f9ed32d2b310e391a4f107d5f0f071df785bfee
278 278 user: test
279 279 date: Thu Jan 01 00:00:09 1970 +0000
280 280 extra: branch=b
281 281 extra: close=1
282 282 description:
283 283 close this part branch too
284 284
285 285
286 286 --- b branch should be inactive
287 287
288 288 $ hg branches
289 289 a branch name much longer than the default justification used by branches 7:10ff5895aa57
290 290 c 6:589736a22561 (inactive)
291 291 a 5:d8cbc61dbaa6 (inactive)
292 292 default 0:19709c5a4e75 (inactive)
293 293 $ hg branches -c
294 294 a branch name much longer than the default justification used by branches 7:10ff5895aa57
295 295 b 12:e3d49c0575d8 (closed)
296 296 c 6:589736a22561 (inactive)
297 297 a 5:d8cbc61dbaa6 (inactive)
298 298 default 0:19709c5a4e75 (inactive)
299 299 $ hg branches -a
300 300 a branch name much longer than the default justification used by branches 7:10ff5895aa57
301 301 $ hg branches -q
302 302 a branch name much longer than the default justification used by branches
303 303 c
304 304 a
305 305 default
306 306 $ hg heads b
307 307 no open branch heads found on branches b
308 308 [1]
309 309 $ hg heads --closed b
310 310 changeset: 12:e3d49c0575d8
311 311 branch: b
312 312 tag: tip
313 313 parent: 8:eebb944467c9
314 314 user: test
315 315 date: Thu Jan 01 00:00:09 1970 +0000
316 316 summary: close this part branch too
317 317
318 318 changeset: 11:d3f163457ebf
319 319 branch: b
320 320 user: test
321 321 date: Thu Jan 01 00:00:09 1970 +0000
322 322 summary: prune bad branch
323 323
324 324 $ echo 'xxx4' >> b
325 325 $ hg commit -d '9 0' -m 'reopen branch with a change'
326 326 reopening closed branch head 12
327 327
328 328 --- branch b is back in action
329 329
330 330 $ hg branches -a
331 331 b 13:e23b5505d1ad
332 332 a branch name much longer than the default justification used by branches 7:10ff5895aa57
333 333
334 334 ---- test heads listings
335 335
336 336 $ hg heads
337 337 changeset: 13:e23b5505d1ad
338 338 branch: b
339 339 tag: tip
340 340 user: test
341 341 date: Thu Jan 01 00:00:09 1970 +0000
342 342 summary: reopen branch with a change
343 343
344 344 changeset: 7:10ff5895aa57
345 345 branch: a branch name much longer than the default justification used by branches
346 346 user: test
347 347 date: Thu Jan 01 00:00:06 1970 +0000
348 348 summary: Adding d branch
349 349
350 350 changeset: 6:589736a22561
351 351 branch: c
352 352 user: test
353 353 date: Thu Jan 01 00:00:05 1970 +0000
354 354 summary: Adding c branch
355 355
356 356 changeset: 5:d8cbc61dbaa6
357 357 branch: a
358 358 parent: 2:881fe2b92ad0
359 359 user: test
360 360 date: Thu Jan 01 00:00:04 1970 +0000
361 361 summary: Adding b branch head 2
362 362
363 363 changeset: 0:19709c5a4e75
364 364 user: test
365 365 date: Thu Jan 01 00:00:00 1970 +0000
366 366 summary: Adding root node
367 367
368 368
369 369 branch default
370 370
371 371 $ hg heads default
372 372 changeset: 0:19709c5a4e75
373 373 user: test
374 374 date: Thu Jan 01 00:00:00 1970 +0000
375 375 summary: Adding root node
376 376
377 377
378 378 branch a
379 379
380 380 $ hg heads a
381 381 changeset: 5:d8cbc61dbaa6
382 382 branch: a
383 383 parent: 2:881fe2b92ad0
384 384 user: test
385 385 date: Thu Jan 01 00:00:04 1970 +0000
386 386 summary: Adding b branch head 2
387 387
388 388 $ hg heads --active a
389 389 no open branch heads found on branches a
390 390 [1]
391 391
392 392 branch b
393 393
394 394 $ hg heads b
395 395 changeset: 13:e23b5505d1ad
396 396 branch: b
397 397 tag: tip
398 398 user: test
399 399 date: Thu Jan 01 00:00:09 1970 +0000
400 400 summary: reopen branch with a change
401 401
402 402 $ hg heads --closed b
403 403 changeset: 13:e23b5505d1ad
404 404 branch: b
405 405 tag: tip
406 406 user: test
407 407 date: Thu Jan 01 00:00:09 1970 +0000
408 408 summary: reopen branch with a change
409 409
410 410 changeset: 11:d3f163457ebf
411 411 branch: b
412 412 user: test
413 413 date: Thu Jan 01 00:00:09 1970 +0000
414 414 summary: prune bad branch
415 415
416 416 default branch colors:
417 417
418 418 $ cat <<EOF >> $HGRCPATH
419 419 > [extensions]
420 420 > color =
421 421 > [color]
422 422 > mode = ansi
423 423 > EOF
424 424
425 425 $ hg up -C c
426 426 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
427 427 $ hg commit -d '9 0' --close-branch -m 'reclosing this branch'
428 428 $ hg up -C b
429 429 2 files updated, 0 files merged, 3 files removed, 0 files unresolved
430 430 $ hg branches --color=always
431 431 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
432 432 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
433 433 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
434 434 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
435 435
436 436 default closed branch color:
437 437
438 438 $ hg branches --color=always --closed
439 439 \x1b[0;32mb\x1b[0m\x1b[0;33m 13:e23b5505d1ad\x1b[0m (esc)
440 440 \x1b[0;0ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;33m 7:10ff5895aa57\x1b[0m (esc)
441 441 \x1b[0;30;1mc\x1b[0m\x1b[0;33m 14:f894c25619d3\x1b[0m (closed) (esc)
442 442 \x1b[0;0ma\x1b[0m\x1b[0;33m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
443 443 \x1b[0;0mdefault\x1b[0m\x1b[0;33m 0:19709c5a4e75\x1b[0m (inactive) (esc)
444 444
445 445 $ cat <<EOF >> $HGRCPATH
446 446 > [extensions]
447 447 > color =
448 448 > [color]
449 449 > branches.active = green
450 450 > branches.closed = blue
451 451 > branches.current = red
452 452 > branches.inactive = magenta
453 453 > log.changeset = cyan
454 454 > EOF
455 455
456 456 custom branch colors:
457 457
458 458 $ hg branches --color=always
459 459 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
460 460 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
461 461 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
462 462 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
463 463
464 464 custom closed branch color:
465 465
466 466 $ hg branches --color=always --closed
467 467 \x1b[0;31mb\x1b[0m\x1b[0;36m 13:e23b5505d1ad\x1b[0m (esc)
468 468 \x1b[0;32ma branch name much longer than the default justification used by branches\x1b[0m\x1b[0;36m 7:10ff5895aa57\x1b[0m (esc)
469 469 \x1b[0;34mc\x1b[0m\x1b[0;36m 14:f894c25619d3\x1b[0m (closed) (esc)
470 470 \x1b[0;35ma\x1b[0m\x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc)
471 471 \x1b[0;35mdefault\x1b[0m\x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc)
472 472
473 473 template output:
474 474
475 475 $ hg branches -Tjson --closed
476 476 [
477 477 {
478 478 "active": true,
479 479 "branch": "b",
480 480 "closed": false,
481 481 "current": true,
482 482 "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0",
483 483 "rev": 13
484 484 },
485 485 {
486 486 "active": true,
487 487 "branch": "a branch name much longer than the default justification used by branches",
488 488 "closed": false,
489 489 "current": false,
490 490 "node": "10ff5895aa5793bd378da574af8cec8ea408d831",
491 491 "rev": 7
492 492 },
493 493 {
494 494 "active": false,
495 495 "branch": "c",
496 496 "closed": true,
497 497 "current": false,
498 498 "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6",
499 499 "rev": 14
500 500 },
501 501 {
502 502 "active": false,
503 503 "branch": "a",
504 504 "closed": false,
505 505 "current": false,
506 506 "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832",
507 507 "rev": 5
508 508 },
509 509 {
510 510 "active": false,
511 511 "branch": "default",
512 512 "closed": false,
513 513 "current": false,
514 514 "node": "19709c5a4e75bf938f8e349aff97438539bb729e",
515 515 "rev": 0
516 516 }
517 517 ]
518 518
519 519
520 520 Tests of revision branch name caching
521 521
522 522 We rev branch cache is updated automatically. In these tests we use a trick to
523 523 trigger rebuilds. We remove the branch head cache and run 'hg head' to cause a
524 524 rebuild that also will populate the rev branch cache.
525 525
526 526 revision branch cache is created when building the branch head cache
527 527 $ rm -rf .hg/cache; hg head a -T '{rev}\n'
528 528 5
529 529 $ f --hexdump --size .hg/cache/rbc-*
530 530 .hg/cache/rbc-names-v1: size=87
531 531 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
532 532 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
533 533 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
534 534 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
535 535 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
536 536 0050: 72 61 6e 63 68 65 73 |ranches|
537 537 .hg/cache/rbc-revs-v1: size=120
538 538 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
539 539 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
540 540 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
541 541 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
542 542 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
543 543 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
544 544 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
545 545 0070: f8 94 c2 56 80 00 00 03 |...V....|
546 546
547 #if unix-permissions no-root
548 547 no errors when revbranchcache is not writable
549 548
550 549 $ echo >> .hg/cache/rbc-revs-v1
551 $ chmod a-w .hg/cache/rbc-revs-v1
550 $ mv .hg/cache/rbc-revs-v1 .hg/cache/rbc-revs-v1_
551 $ mkdir .hg/cache/rbc-revs-v1
552 552 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n'
553 553 5
554 $ chmod a+w .hg/cache/rbc-revs-v1
555 #endif
554 $ rmdir .hg/cache/rbc-revs-v1
555 $ mv .hg/cache/rbc-revs-v1_ .hg/cache/rbc-revs-v1
556 556
557 557 recovery from invalid cache revs file with trailing data
558 558 $ echo >> .hg/cache/rbc-revs-v1
559 559 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
560 560 5
561 561 truncating cache/rbc-revs-v1 to 120
562 562 $ f --size .hg/cache/rbc-revs*
563 563 .hg/cache/rbc-revs-v1: size=120
564 564 recovery from invalid cache file with partial last record
565 565 $ mv .hg/cache/rbc-revs-v1 .
566 566 $ f -qDB 119 rbc-revs-v1 > .hg/cache/rbc-revs-v1
567 567 $ f --size .hg/cache/rbc-revs*
568 568 .hg/cache/rbc-revs-v1: size=119
569 569 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
570 570 5
571 571 truncating cache/rbc-revs-v1 to 112
572 572 $ f --size .hg/cache/rbc-revs*
573 573 .hg/cache/rbc-revs-v1: size=120
574 574 recovery from invalid cache file with missing record - no truncation
575 575 $ mv .hg/cache/rbc-revs-v1 .
576 576 $ f -qDB 112 rbc-revs-v1 > .hg/cache/rbc-revs-v1
577 577 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
578 578 5
579 579 $ f --size .hg/cache/rbc-revs*
580 580 .hg/cache/rbc-revs-v1: size=120
581 581 recovery from invalid cache file with some bad records
582 582 $ mv .hg/cache/rbc-revs-v1 .
583 583 $ f -qDB 8 rbc-revs-v1 > .hg/cache/rbc-revs-v1
584 584 $ f --size .hg/cache/rbc-revs*
585 585 .hg/cache/rbc-revs-v1: size=8
586 586 $ f -qDB 112 rbc-revs-v1 >> .hg/cache/rbc-revs-v1
587 587 $ f --size .hg/cache/rbc-revs*
588 588 .hg/cache/rbc-revs-v1: size=120
589 589 $ hg log -r 'branch(.)' -T '{rev} ' --debug
590 590 3 4 8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 8
591 591 $ rm -f .hg/cache/branch* && hg head a -T '{rev}\n' --debug
592 592 5
593 593 truncating cache/rbc-revs-v1 to 104
594 594 $ f --size --hexdump --bytes=16 .hg/cache/rbc-revs*
595 595 .hg/cache/rbc-revs-v1: size=120
596 596 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
597 597 cache is updated when committing
598 598 $ hg branch i-will-regret-this
599 599 marked working directory as branch i-will-regret-this
600 600 $ hg ci -m regrets
601 601 $ f --size .hg/cache/rbc-*
602 602 .hg/cache/rbc-names-v1: size=106
603 603 .hg/cache/rbc-revs-v1: size=128
604 604 update after rollback - the cache will be correct but rbc-names will will still
605 605 contain the branch name even though it no longer is used
606 606 $ hg up -qr '.^'
607 607 $ hg rollback -qf
608 608 $ f --size --hexdump .hg/cache/rbc-*
609 609 .hg/cache/rbc-names-v1: size=106
610 610 0000: 64 65 66 61 75 6c 74 00 61 00 62 00 63 00 61 20 |default.a.b.c.a |
611 611 0010: 62 72 61 6e 63 68 20 6e 61 6d 65 20 6d 75 63 68 |branch name much|
612 612 0020: 20 6c 6f 6e 67 65 72 20 74 68 61 6e 20 74 68 65 | longer than the|
613 613 0030: 20 64 65 66 61 75 6c 74 20 6a 75 73 74 69 66 69 | default justifi|
614 614 0040: 63 61 74 69 6f 6e 20 75 73 65 64 20 62 79 20 62 |cation used by b|
615 615 0050: 72 61 6e 63 68 65 73 00 69 2d 77 69 6c 6c 2d 72 |ranches.i-will-r|
616 616 0060: 65 67 72 65 74 2d 74 68 69 73 |egret-this|
617 617 .hg/cache/rbc-revs-v1: size=120
618 618 0000: 19 70 9c 5a 00 00 00 00 dd 6b 44 0d 00 00 00 01 |.p.Z.....kD.....|
619 619 0010: 88 1f e2 b9 00 00 00 01 ac 22 03 33 00 00 00 02 |.........".3....|
620 620 0020: ae e3 9c d1 00 00 00 02 d8 cb c6 1d 00 00 00 01 |................|
621 621 0030: 58 97 36 a2 00 00 00 03 10 ff 58 95 00 00 00 04 |X.6.......X.....|
622 622 0040: ee bb 94 44 00 00 00 02 5f 40 61 bb 00 00 00 02 |...D...._@a.....|
623 623 0050: bf be 84 1b 00 00 00 02 d3 f1 63 45 80 00 00 02 |..........cE....|
624 624 0060: e3 d4 9c 05 80 00 00 02 e2 3b 55 05 00 00 00 02 |.........;U.....|
625 625 0070: f8 94 c2 56 80 00 00 03 |...V....|
626 626 cache is updated/truncated when stripping - it is thus very hard to get in a
627 627 situation where the cache is out of sync and the hash check detects it
628 628 $ hg --config extensions.strip= strip -r tip --nob
629 629 $ f --size .hg/cache/rbc-revs*
630 630 .hg/cache/rbc-revs-v1: size=112
631 631
632 632 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now