##// END OF EJS Templates
test-annotate: fix up expected output for pure...
Augie Fackler -
r34488:323bed58 default
parent child Browse files
Show More
@@ -1,1001 +1,1001
1 1 $ HGMERGE=true; export HGMERGE
2 2
3 3 init
4 4
5 5 $ hg init repo
6 6 $ cd repo
7 7
8 8 commit
9 9
10 10 $ echo 'a' > a
11 11 $ hg ci -A -m test -u nobody -d '1 0'
12 12 adding a
13 13
14 14 annotate -c
15 15
16 16 $ hg annotate -c a
17 17 8435f90966e4: a
18 18
19 19 annotate -cl
20 20
21 21 $ hg annotate -cl a
22 22 8435f90966e4:1: a
23 23
24 24 annotate -d
25 25
26 26 $ hg annotate -d a
27 27 Thu Jan 01 00:00:01 1970 +0000: a
28 28
29 29 annotate -n
30 30
31 31 $ hg annotate -n a
32 32 0: a
33 33
34 34 annotate -nl
35 35
36 36 $ hg annotate -nl a
37 37 0:1: a
38 38
39 39 annotate -u
40 40
41 41 $ hg annotate -u a
42 42 nobody: a
43 43
44 44 annotate -cdnu
45 45
46 46 $ hg annotate -cdnu a
47 47 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
48 48
49 49 annotate -cdnul
50 50
51 51 $ hg annotate -cdnul a
52 52 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
53 53
54 54 annotate (JSON)
55 55
56 56 $ hg annotate -Tjson a
57 57 [
58 58 {
59 59 "abspath": "a",
60 60 "lines": [{"line": "a\n", "rev": 0}],
61 61 "path": "a"
62 62 }
63 63 ]
64 64
65 65 $ hg annotate -Tjson -cdfnul a
66 66 [
67 67 {
68 68 "abspath": "a",
69 69 "lines": [{"date": [1.0, 0], "file": "a", "line": "a\n", "line_number": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "rev": 0, "user": "nobody"}],
70 70 "path": "a"
71 71 }
72 72 ]
73 73
74 74 $ cat <<EOF >>a
75 75 > a
76 76 > a
77 77 > EOF
78 78 $ hg ci -ma1 -d '1 0'
79 79 $ hg cp a b
80 80 $ hg ci -mb -d '1 0'
81 81 $ cat <<EOF >> b
82 82 > b4
83 83 > b5
84 84 > b6
85 85 > EOF
86 86 $ hg ci -mb2 -d '2 0'
87 87
88 88 annotate multiple files (JSON)
89 89
90 90 $ hg annotate -Tjson a b
91 91 [
92 92 {
93 93 "abspath": "a",
94 94 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}],
95 95 "path": "a"
96 96 },
97 97 {
98 98 "abspath": "b",
99 99 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}],
100 100 "path": "b"
101 101 }
102 102 ]
103 103
104 104 annotate multiple files (template)
105 105
106 106 $ hg annotate -T'== {abspath} ==\n{lines % "{rev}: {line}"}' a b
107 107 == a ==
108 108 0: a
109 109 1: a
110 110 1: a
111 111 == b ==
112 112 0: a
113 113 1: a
114 114 1: a
115 115 3: b4
116 116 3: b5
117 117 3: b6
118 118
119 119 annotate -n b
120 120
121 121 $ hg annotate -n b
122 122 0: a
123 123 1: a
124 124 1: a
125 125 3: b4
126 126 3: b5
127 127 3: b6
128 128
129 129 annotate --no-follow b
130 130
131 131 $ hg annotate --no-follow b
132 132 2: a
133 133 2: a
134 134 2: a
135 135 3: b4
136 136 3: b5
137 137 3: b6
138 138
139 139 annotate -nl b
140 140
141 141 $ hg annotate -nl b
142 142 0:1: a
143 143 1:2: a
144 144 1:3: a
145 145 3:4: b4
146 146 3:5: b5
147 147 3:6: b6
148 148
149 149 annotate -nf b
150 150
151 151 $ hg annotate -nf b
152 152 0 a: a
153 153 1 a: a
154 154 1 a: a
155 155 3 b: b4
156 156 3 b: b5
157 157 3 b: b6
158 158
159 159 annotate -nlf b
160 160
161 161 $ hg annotate -nlf b
162 162 0 a:1: a
163 163 1 a:2: a
164 164 1 a:3: a
165 165 3 b:4: b4
166 166 3 b:5: b5
167 167 3 b:6: b6
168 168
169 169 $ hg up -C 2
170 170 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 171 $ cat <<EOF >> b
172 172 > b4
173 173 > c
174 174 > b5
175 175 > EOF
176 176 $ hg ci -mb2.1 -d '2 0'
177 177 created new head
178 178 $ hg merge
179 179 merging b
180 180 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
181 181 (branch merge, don't forget to commit)
182 182 $ hg ci -mmergeb -d '3 0'
183 183
184 184 annotate after merge
185 185
186 186 $ hg annotate -nf b
187 187 0 a: a
188 188 1 a: a
189 189 1 a: a
190 190 3 b: b4
191 191 4 b: c
192 192 3 b: b5
193 193
194 194 annotate after merge with -l
195 195
196 196 $ hg annotate -nlf b
197 197 0 a:1: a
198 198 1 a:2: a
199 199 1 a:3: a
200 200 3 b:4: b4
201 201 4 b:5: c
202 202 3 b:5: b5
203 203
204 204 $ hg up -C 1
205 205 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
206 206 $ hg cp a b
207 207 $ cat <<EOF > b
208 208 > a
209 209 > z
210 210 > a
211 211 > EOF
212 212 $ hg ci -mc -d '3 0'
213 213 created new head
214 214 $ hg merge
215 215 merging b
216 216 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
217 217 (branch merge, don't forget to commit)
218 218 $ cat <<EOF >> b
219 219 > b4
220 220 > c
221 221 > b5
222 222 > EOF
223 223 $ echo d >> b
224 224 $ hg ci -mmerge2 -d '4 0'
225 225
226 226 annotate after rename merge
227 227
228 228 $ hg annotate -nf b
229 229 0 a: a
230 230 6 b: z
231 231 1 a: a
232 232 3 b: b4
233 233 4 b: c
234 234 3 b: b5
235 235 7 b: d
236 236
237 237 annotate after rename merge with -l
238 238
239 239 $ hg annotate -nlf b
240 240 0 a:1: a
241 241 6 b:2: z
242 242 1 a:3: a
243 243 3 b:4: b4
244 244 4 b:5: c
245 245 3 b:5: b5
246 246 7 b:7: d
247 247
248 248 --skip nothing (should be the same as no --skip at all)
249 249
250 250 $ hg annotate -nlf b --skip '1::0'
251 251 0 a:1: a
252 252 6 b:2: z
253 253 1 a:3: a
254 254 3 b:4: b4
255 255 4 b:5: c
256 256 3 b:5: b5
257 257 7 b:7: d
258 258
259 259 --skip a modified line. Note a slight behavior difference in pure - this is
260 260 because the pure code comes up with slightly different deltas internally.
261 261
262 262 $ hg annotate -nlf b --skip 6
263 263 0 a:1: a
264 0 a:1: z (pure !)
265 1 a:2* z
264 1 a:2* z (no-pure !)
265 0 a:1* z (pure !)
266 266 1 a:3: a
267 267 3 b:4: b4
268 268 4 b:5: c
269 269 3 b:5: b5
270 270 7 b:7: d
271 271
272 272 --skip added lines (and test multiple skip)
273 273
274 274 $ hg annotate -nlf b --skip 3
275 275 0 a:1: a
276 276 6 b:2: z
277 277 1 a:3: a
278 278 1 a:3* b4
279 279 4 b:5: c
280 280 1 a:3* b5
281 281 7 b:7: d
282 282
283 283 $ hg annotate -nlf b --skip 4
284 284 0 a:1: a
285 285 6 b:2: z
286 286 1 a:3: a
287 287 3 b:4: b4
288 288 1 a:3* c
289 289 3 b:5: b5
290 290 7 b:7: d
291 291
292 292 $ hg annotate -nlf b --skip 3 --skip 4
293 293 0 a:1: a
294 294 6 b:2: z
295 295 1 a:3: a
296 296 1 a:3* b4
297 297 1 a:3* c
298 298 1 a:3* b5
299 299 7 b:7: d
300 300
301 301 $ hg annotate -nlf b --skip 'merge()'
302 302 0 a:1: a
303 303 6 b:2: z
304 304 1 a:3: a
305 305 3 b:4: b4
306 306 4 b:5: c
307 307 3 b:5: b5
308 308 3 b:5* d
309 309
310 310 --skip everything -- use the revision the file was introduced in
311 311
312 312 $ hg annotate -nlf b --skip 'all()'
313 313 0 a:1: a
314 314 0 a:1* z
315 315 0 a:1* a
316 316 0 a:1* b4
317 317 0 a:1* c
318 318 0 a:1* b5
319 319 0 a:1* d
320 320
321 321 Issue2807: alignment of line numbers with -l
322 322
323 323 $ echo more >> b
324 324 $ hg ci -mmore -d '5 0'
325 325 $ echo more >> b
326 326 $ hg ci -mmore -d '6 0'
327 327 $ echo more >> b
328 328 $ hg ci -mmore -d '7 0'
329 329 $ hg annotate -nlf b
330 330 0 a: 1: a
331 331 6 b: 2: z
332 332 1 a: 3: a
333 333 3 b: 4: b4
334 334 4 b: 5: c
335 335 3 b: 5: b5
336 336 7 b: 7: d
337 337 8 b: 8: more
338 338 9 b: 9: more
339 339 10 b:10: more
340 340
341 341 linkrev vs rev
342 342
343 343 $ hg annotate -r tip -n a
344 344 0: a
345 345 1: a
346 346 1: a
347 347
348 348 linkrev vs rev with -l
349 349
350 350 $ hg annotate -r tip -nl a
351 351 0:1: a
352 352 1:2: a
353 353 1:3: a
354 354
355 355 Issue589: "undelete" sequence leads to crash
356 356
357 357 annotate was crashing when trying to --follow something
358 358
359 359 like A -> B -> A
360 360
361 361 generate ABA rename configuration
362 362
363 363 $ echo foo > foo
364 364 $ hg add foo
365 365 $ hg ci -m addfoo
366 366 $ hg rename foo bar
367 367 $ hg ci -m renamefoo
368 368 $ hg rename bar foo
369 369 $ hg ci -m renamebar
370 370
371 371 annotate after ABA with follow
372 372
373 373 $ hg annotate --follow foo
374 374 foo: foo
375 375
376 376 missing file
377 377
378 378 $ hg ann nosuchfile
379 379 abort: nosuchfile: no such file in rev e9e6b4fa872f
380 380 [255]
381 381
382 382 annotate file without '\n' on last line
383 383
384 384 $ printf "" > c
385 385 $ hg ci -A -m test -u nobody -d '1 0'
386 386 adding c
387 387 $ hg annotate c
388 388 $ printf "a\nb" > c
389 389 $ hg ci -m test
390 390 $ hg annotate c
391 391 [0-9]+: a (re)
392 392 [0-9]+: b (re)
393 393
394 394 Issue3841: check annotation of the file of which filelog includes
395 395 merging between the revision and its ancestor
396 396
397 397 to reproduce the situation with recent Mercurial, this script uses (1)
398 398 "hg debugsetparents" to merge without ancestor check by "hg merge",
399 399 and (2) the extension to allow filelog merging between the revision
400 400 and its ancestor by overriding "repo._filecommit".
401 401
402 402 $ cat > ../legacyrepo.py <<EOF
403 403 > from __future__ import absolute_import
404 404 > from mercurial import error, node
405 405 > def reposetup(ui, repo):
406 406 > class legacyrepo(repo.__class__):
407 407 > def _filecommit(self, fctx, manifest1, manifest2,
408 408 > linkrev, tr, changelist):
409 409 > fname = fctx.path()
410 410 > text = fctx.data()
411 411 > flog = self.file(fname)
412 412 > fparent1 = manifest1.get(fname, node.nullid)
413 413 > fparent2 = manifest2.get(fname, node.nullid)
414 414 > meta = {}
415 415 > copy = fctx.renamed()
416 416 > if copy and copy[0] != fname:
417 417 > raise error.Abort('copying is not supported')
418 418 > if fparent2 != node.nullid:
419 419 > changelist.append(fname)
420 420 > return flog.add(text, meta, tr, linkrev,
421 421 > fparent1, fparent2)
422 422 > raise error.Abort('only merging is supported')
423 423 > repo.__class__ = legacyrepo
424 424 > EOF
425 425
426 426 $ cat > baz <<EOF
427 427 > 1
428 428 > 2
429 429 > 3
430 430 > 4
431 431 > 5
432 432 > EOF
433 433 $ hg add baz
434 434 $ hg commit -m "baz:0"
435 435
436 436 $ cat > baz <<EOF
437 437 > 1 baz:1
438 438 > 2
439 439 > 3
440 440 > 4
441 441 > 5
442 442 > EOF
443 443 $ hg commit -m "baz:1"
444 444
445 445 $ cat > baz <<EOF
446 446 > 1 baz:1
447 447 > 2 baz:2
448 448 > 3
449 449 > 4
450 450 > 5
451 451 > EOF
452 452 $ hg debugsetparents 17 17
453 453 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
454 454 $ hg debugindexdot .hg/store/data/baz.i
455 455 digraph G {
456 456 -1 -> 0
457 457 0 -> 1
458 458 1 -> 2
459 459 1 -> 2
460 460 }
461 461 $ hg annotate baz
462 462 17: 1 baz:1
463 463 18: 2 baz:2
464 464 16: 3
465 465 16: 4
466 466 16: 5
467 467
468 468 $ cat > baz <<EOF
469 469 > 1 baz:1
470 470 > 2 baz:2
471 471 > 3 baz:3
472 472 > 4
473 473 > 5
474 474 > EOF
475 475 $ hg commit -m "baz:3"
476 476
477 477 $ cat > baz <<EOF
478 478 > 1 baz:1
479 479 > 2 baz:2
480 480 > 3 baz:3
481 481 > 4 baz:4
482 482 > 5
483 483 > EOF
484 484 $ hg debugsetparents 19 18
485 485 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
486 486 $ hg debugindexdot .hg/store/data/baz.i
487 487 digraph G {
488 488 -1 -> 0
489 489 0 -> 1
490 490 1 -> 2
491 491 1 -> 2
492 492 2 -> 3
493 493 3 -> 4
494 494 2 -> 4
495 495 }
496 496 $ hg annotate baz
497 497 17: 1 baz:1
498 498 18: 2 baz:2
499 499 19: 3 baz:3
500 500 20: 4 baz:4
501 501 16: 5
502 502
503 503 annotate clean file
504 504
505 505 $ hg annotate -ncr "wdir()" foo
506 506 11 472b18db256d : foo
507 507
508 508 annotate modified file
509 509
510 510 $ echo foofoo >> foo
511 511 $ hg annotate -r "wdir()" foo
512 512 11 : foo
513 513 20+: foofoo
514 514
515 515 $ hg annotate -cr "wdir()" foo
516 516 472b18db256d : foo
517 517 b6bedd5477e7+: foofoo
518 518
519 519 $ hg annotate -ncr "wdir()" foo
520 520 11 472b18db256d : foo
521 521 20 b6bedd5477e7+: foofoo
522 522
523 523 $ hg annotate --debug -ncr "wdir()" foo
524 524 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
525 525 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
526 526
527 527 $ hg annotate -udr "wdir()" foo
528 528 test Thu Jan 01 00:00:00 1970 +0000: foo
529 529 test [A-Za-z0-9:+ ]+: foofoo (re)
530 530
531 531 $ hg annotate -ncr "wdir()" -Tjson foo
532 532 [
533 533 {
534 534 "abspath": "foo",
535 535 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": null, "rev": null}],
536 536 "path": "foo"
537 537 }
538 538 ]
539 539
540 540 annotate added file
541 541
542 542 $ echo bar > bar
543 543 $ hg add bar
544 544 $ hg annotate -ncr "wdir()" bar
545 545 20 b6bedd5477e7+: bar
546 546
547 547 annotate renamed file
548 548
549 549 $ hg rename foo renamefoo2
550 550 $ hg annotate -ncr "wdir()" renamefoo2
551 551 11 472b18db256d : foo
552 552 20 b6bedd5477e7+: foofoo
553 553
554 554 annotate missing file
555 555
556 556 $ rm baz
557 557
558 558 $ hg annotate -ncr "wdir()" baz
559 559 abort: $TESTTMP\repo\baz: The system cannot find the file specified (windows !)
560 560 abort: No such file or directory: $TESTTMP/repo/baz (no-windows !)
561 561 [255]
562 562
563 563 annotate removed file
564 564
565 565 $ hg rm baz
566 566
567 567 $ hg annotate -ncr "wdir()" baz
568 568 abort: $TESTTMP\repo\baz: The system cannot find the file specified (windows !)
569 569 abort: No such file or directory: $TESTTMP/repo/baz (no-windows !)
570 570 [255]
571 571
572 572 $ hg revert --all --no-backup --quiet
573 573 $ hg id -n
574 574 20
575 575
576 576 Test followlines() revset; we usually check both followlines(pat, range) and
577 577 followlines(pat, range, descend=True) to make sure both give the same result
578 578 when they should.
579 579
580 580 $ echo a >> foo
581 581 $ hg ci -m 'foo: add a'
582 582 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
583 583 16: baz:0
584 584 19: baz:3
585 585 20: baz:4
586 586 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
587 587 16: baz:0
588 588 19: baz:3
589 589 20: baz:4
590 590 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19)'
591 591 16: baz:0
592 592 19: baz:3
593 593 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=True)'
594 594 19: baz:3
595 595 20: baz:4
596 596 $ printf "0\n0\n" | cat - baz > baz1
597 597 $ mv baz1 baz
598 598 $ hg ci -m 'added two lines with 0'
599 599 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
600 600 16: baz:0
601 601 19: baz:3
602 602 20: baz:4
603 603 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, descend=true, startrev=19)'
604 604 19: baz:3
605 605 20: baz:4
606 606 $ echo 6 >> baz
607 607 $ hg ci -m 'added line 8'
608 608 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
609 609 16: baz:0
610 610 19: baz:3
611 611 20: baz:4
612 612 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=1)'
613 613 19: baz:3
614 614 20: baz:4
615 615 $ sed 's/3/3+/' baz > baz.new
616 616 $ mv baz.new baz
617 617 $ hg ci -m 'baz:3->3+'
618 618 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
619 619 16: baz:0
620 620 19: baz:3
621 621 20: baz:4
622 622 24: baz:3->3+
623 623 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
624 624 19: baz:3
625 625 20: baz:4
626 626 24: baz:3->3+
627 627 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
628 628 22: added two lines with 0
629 629
630 630 file patterns are okay
631 631 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
632 632 22: added two lines with 0
633 633
634 634 renames are followed
635 635 $ hg mv baz qux
636 636 $ sed 's/4/4+/' qux > qux.new
637 637 $ mv qux.new qux
638 638 $ hg ci -m 'qux:4->4+'
639 639 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
640 640 16: baz:0
641 641 19: baz:3
642 642 20: baz:4
643 643 24: baz:3->3+
644 644 25: qux:4->4+
645 645
646 646 but are missed when following children
647 647 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
648 648 24: baz:3->3+
649 649
650 650 merge
651 651 $ hg up 24 --quiet
652 652 $ echo 7 >> baz
653 653 $ hg ci -m 'one more line, out of line range'
654 654 created new head
655 655 $ sed 's/3+/3-/' baz > baz.new
656 656 $ mv baz.new baz
657 657 $ hg ci -m 'baz:3+->3-'
658 658 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
659 659 16: baz:0
660 660 19: baz:3
661 661 20: baz:4
662 662 24: baz:3->3+
663 663 27: baz:3+->3-
664 664 $ hg merge 25
665 665 merging baz and qux to qux
666 666 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
667 667 (branch merge, don't forget to commit)
668 668 $ hg ci -m merge
669 669 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
670 670 16: baz:0
671 671 19: baz:3
672 672 20: baz:4
673 673 24: baz:3->3+
674 674 25: qux:4->4+
675 675 27: baz:3+->3-
676 676 28: merge
677 677 $ hg up 25 --quiet
678 678 $ hg merge 27
679 679 merging qux and baz to qux
680 680 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
681 681 (branch merge, don't forget to commit)
682 682 $ hg ci -m 'merge from other side'
683 683 created new head
684 684 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
685 685 16: baz:0
686 686 19: baz:3
687 687 20: baz:4
688 688 24: baz:3->3+
689 689 25: qux:4->4+
690 690 27: baz:3+->3-
691 691 29: merge from other side
692 692 $ hg up 24 --quiet
693 693
694 694 we are missing the branch with rename when following children
695 695 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
696 696 27: baz:3+->3-
697 697
698 698 we follow all branches in descending direction
699 699 $ hg up 23 --quiet
700 700 $ sed 's/3/+3/' baz > baz.new
701 701 $ mv baz.new baz
702 702 $ hg ci -m 'baz:3->+3'
703 703 created new head
704 704 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
705 705 @ 30: baz:3->+3
706 706 :
707 707 : o 27: baz:3+->3-
708 708 : :
709 709 : o 24: baz:3->3+
710 710 :/
711 711 o 20: baz:4
712 712 |\
713 713 | o 19: baz:3
714 714 |/
715 715 o 18: baz:2
716 716 :
717 717 o 16: baz:0
718 718 |
719 719 ~
720 720
721 721 Issue5595: on a merge changeset with different line ranges depending on
722 722 parent, be conservative and use the surrounding interval to avoid loosing
723 723 track of possible further descendants in specified range.
724 724
725 725 $ hg up 23 --quiet
726 726 $ hg cat baz -r 24
727 727 0
728 728 0
729 729 1 baz:1
730 730 2 baz:2
731 731 3+ baz:3
732 732 4 baz:4
733 733 5
734 734 6
735 735 $ cat > baz << EOF
736 736 > 0
737 737 > 0
738 738 > a
739 739 > b
740 740 > 3+ baz:3
741 741 > 4 baz:4
742 742 > y
743 743 > z
744 744 > EOF
745 745 $ hg ci -m 'baz: mostly rewrite with some content from 24'
746 746 created new head
747 747 $ hg merge --tool :merge-other 24
748 748 merging baz
749 749 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
750 750 (branch merge, don't forget to commit)
751 751 $ hg ci -m 'merge forgetting about baz rewrite'
752 752 $ cat > baz << EOF
753 753 > 0
754 754 > 0
755 755 > 1 baz:1
756 756 > 2+ baz:2
757 757 > 3+ baz:3
758 758 > 4 baz:4
759 759 > 5
760 760 > 6
761 761 > EOF
762 762 $ hg ci -m 'baz: narrow change (2->2+)'
763 763 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:4, startrev=20, descend=True)' --graph
764 764 @ 33: baz: narrow change (2->2+)
765 765 |
766 766 o 32: merge forgetting about baz rewrite
767 767 |\
768 768 | o 31: baz: mostly rewrite with some content from 24
769 769 | :
770 770 | : o 30: baz:3->+3
771 771 | :/
772 772 +---o 27: baz:3+->3-
773 773 | :
774 774 o : 24: baz:3->3+
775 775 :/
776 776 o 20: baz:4
777 777 |\
778 778 ~ ~
779 779
780 780 check error cases
781 781 $ hg up 24 --quiet
782 782 $ hg log -r 'followlines()'
783 783 hg: parse error: followlines takes at least 1 positional arguments
784 784 [255]
785 785 $ hg log -r 'followlines(baz)'
786 786 hg: parse error: followlines requires a line range
787 787 [255]
788 788 $ hg log -r 'followlines(baz, 1)'
789 789 hg: parse error: followlines expects a line range
790 790 [255]
791 791 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
792 792 hg: parse error: followlines expects exactly one revision
793 793 [255]
794 794 $ hg log -r 'followlines("glob:*", 1:2)'
795 795 hg: parse error: followlines expects exactly one file
796 796 [255]
797 797 $ hg log -r 'followlines(baz, 1:)'
798 798 hg: parse error: line range bounds must be integers
799 799 [255]
800 800 $ hg log -r 'followlines(baz, :1)'
801 801 hg: parse error: line range bounds must be integers
802 802 [255]
803 803 $ hg log -r 'followlines(baz, x:4)'
804 804 hg: parse error: line range bounds must be integers
805 805 [255]
806 806 $ hg log -r 'followlines(baz, 5:4)'
807 807 hg: parse error: line range must be positive
808 808 [255]
809 809 $ hg log -r 'followlines(baz, 0:4)'
810 810 hg: parse error: fromline must be strictly positive
811 811 [255]
812 812 $ hg log -r 'followlines(baz, 2:40)'
813 813 abort: line range exceeds file size
814 814 [255]
815 815 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
816 816 hg: parse error at 43: not a prefix: [
817 817 [255]
818 818 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
819 819 hg: parse error: descend argument must be a boolean
820 820 [255]
821 821
822 822 Test empty annotate output
823 823
824 824 $ printf '\0' > binary
825 825 $ touch empty
826 826 $ hg ci -qAm 'add binary and empty files'
827 827
828 828 $ hg annotate binary empty
829 829 binary: binary file
830 830
831 831 $ hg annotate -Tjson binary empty
832 832 [
833 833 {
834 834 "abspath": "binary",
835 835 "path": "binary"
836 836 },
837 837 {
838 838 "abspath": "empty",
839 839 "lines": [],
840 840 "path": "empty"
841 841 }
842 842 ]
843 843
844 844 Test annotate with whitespace options
845 845
846 846 $ cd ..
847 847 $ hg init repo-ws
848 848 $ cd repo-ws
849 849 $ cat > a <<EOF
850 850 > aa
851 851 >
852 852 > b b
853 853 > EOF
854 854 $ hg ci -Am "adda"
855 855 adding a
856 856 $ sed 's/EOL$//g' > a <<EOF
857 857 > a a
858 858 >
859 859 > EOL
860 860 > b b
861 861 > EOF
862 862 $ hg ci -m "changea"
863 863
864 864 Annotate with no option
865 865
866 866 $ hg annotate a
867 867 1: a a
868 868 0:
869 869 1:
870 870 1: b b
871 871
872 872 Annotate with --ignore-space-change
873 873
874 874 $ hg annotate --ignore-space-change a
875 875 1: a a
876 876 1:
877 877 0:
878 878 0: b b
879 879
880 880 Annotate with --ignore-all-space
881 881
882 882 $ hg annotate --ignore-all-space a
883 883 0: a a
884 884 0:
885 885 1:
886 886 0: b b
887 887
888 888 Annotate with --ignore-blank-lines (similar to no options case)
889 889
890 890 $ hg annotate --ignore-blank-lines a
891 891 1: a a
892 892 0:
893 893 1:
894 894 1: b b
895 895
896 896 $ cd ..
897 897
898 898 Annotate with linkrev pointing to another branch
899 899 ------------------------------------------------
900 900
901 901 create history with a filerev whose linkrev points to another branch
902 902
903 903 $ hg init branchedlinkrev
904 904 $ cd branchedlinkrev
905 905 $ echo A > a
906 906 $ hg commit -Am 'contentA'
907 907 adding a
908 908 $ echo B >> a
909 909 $ hg commit -m 'contentB'
910 910 $ hg up --rev 'desc(contentA)'
911 911 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
912 912 $ echo unrelated > unrelated
913 913 $ hg commit -Am 'unrelated'
914 914 adding unrelated
915 915 created new head
916 916 $ hg graft -r 'desc(contentB)'
917 917 grafting 1:fd27c222e3e6 "contentB"
918 918 $ echo C >> a
919 919 $ hg commit -m 'contentC'
920 920 $ echo W >> a
921 921 $ hg log -G
922 922 @ changeset: 4:072f1e8df249
923 923 | tag: tip
924 924 | user: test
925 925 | date: Thu Jan 01 00:00:00 1970 +0000
926 926 | summary: contentC
927 927 |
928 928 o changeset: 3:ff38df03cc4b
929 929 | user: test
930 930 | date: Thu Jan 01 00:00:00 1970 +0000
931 931 | summary: contentB
932 932 |
933 933 o changeset: 2:62aaf3f6fc06
934 934 | parent: 0:f0932f74827e
935 935 | user: test
936 936 | date: Thu Jan 01 00:00:00 1970 +0000
937 937 | summary: unrelated
938 938 |
939 939 | o changeset: 1:fd27c222e3e6
940 940 |/ user: test
941 941 | date: Thu Jan 01 00:00:00 1970 +0000
942 942 | summary: contentB
943 943 |
944 944 o changeset: 0:f0932f74827e
945 945 user: test
946 946 date: Thu Jan 01 00:00:00 1970 +0000
947 947 summary: contentA
948 948
949 949
950 950 Annotate should list ancestor of starting revision only
951 951
952 952 $ hg annotate a
953 953 0: A
954 954 3: B
955 955 4: C
956 956
957 957 $ hg annotate a -r 'wdir()'
958 958 0 : A
959 959 3 : B
960 960 4 : C
961 961 4+: W
962 962
963 963 Even when the starting revision is the linkrev-shadowed one:
964 964
965 965 $ hg annotate a -r 3
966 966 0: A
967 967 3: B
968 968
969 969 $ cd ..
970 970
971 971 Issue5360: Deleted chunk in p1 of a merge changeset
972 972
973 973 $ hg init repo-5360
974 974 $ cd repo-5360
975 975 $ echo 1 > a
976 976 $ hg commit -A a -m 1
977 977 $ echo 2 >> a
978 978 $ hg commit -m 2
979 979 $ echo a > a
980 980 $ hg commit -m a
981 981 $ hg update '.^' -q
982 982 $ echo 3 >> a
983 983 $ hg commit -m 3 -q
984 984 $ hg merge 2 -q
985 985 $ cat > a << EOF
986 986 > b
987 987 > 1
988 988 > 2
989 989 > 3
990 990 > a
991 991 > EOF
992 992 $ hg resolve --mark -q
993 993 $ hg commit -m m
994 994 $ hg annotate a
995 995 4: b
996 996 0: 1
997 997 1: 2
998 998 3: 3
999 999 2: a
1000 1000
1001 1001 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now