##// END OF EJS Templates
test-annotate: conditionalize error output for Windows...
Matt Harbison -
r24498:ab3a8ed7 default
parent child Browse files
Show More
@@ -1,589 +1,601
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 "line": "a\n",
60 60 "rev": 0
61 61 }
62 62 ]
63 63
64 64 $ hg annotate -Tjson -cdfnul a
65 65 [
66 66 {
67 67 "date": [1.0, 0],
68 68 "file": "a",
69 69 "line": "a\n",
70 70 "line_number": 1,
71 71 "node": "8435f90966e442695d2ded29fdade2bac5ad8065",
72 72 "rev": 0,
73 73 "user": "nobody"
74 74 }
75 75 ]
76 76
77 77 $ cat <<EOF >>a
78 78 > a
79 79 > a
80 80 > EOF
81 81 $ hg ci -ma1 -d '1 0'
82 82 $ hg cp a b
83 83 $ hg ci -mb -d '1 0'
84 84 $ cat <<EOF >> b
85 85 > b4
86 86 > b5
87 87 > b6
88 88 > EOF
89 89 $ hg ci -mb2 -d '2 0'
90 90
91 91 annotate -n b
92 92
93 93 $ hg annotate -n b
94 94 0: a
95 95 1: a
96 96 1: a
97 97 3: b4
98 98 3: b5
99 99 3: b6
100 100
101 101 annotate --no-follow b
102 102
103 103 $ hg annotate --no-follow b
104 104 2: a
105 105 2: a
106 106 2: a
107 107 3: b4
108 108 3: b5
109 109 3: b6
110 110
111 111 annotate -nl b
112 112
113 113 $ hg annotate -nl b
114 114 0:1: a
115 115 1:2: a
116 116 1:3: a
117 117 3:4: b4
118 118 3:5: b5
119 119 3:6: b6
120 120
121 121 annotate -nf b
122 122
123 123 $ hg annotate -nf b
124 124 0 a: a
125 125 1 a: a
126 126 1 a: a
127 127 3 b: b4
128 128 3 b: b5
129 129 3 b: b6
130 130
131 131 annotate -nlf b
132 132
133 133 $ hg annotate -nlf b
134 134 0 a:1: a
135 135 1 a:2: a
136 136 1 a:3: a
137 137 3 b:4: b4
138 138 3 b:5: b5
139 139 3 b:6: b6
140 140
141 141 $ hg up -C 2
142 142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
143 143 $ cat <<EOF >> b
144 144 > b4
145 145 > c
146 146 > b5
147 147 > EOF
148 148 $ hg ci -mb2.1 -d '2 0'
149 149 created new head
150 150 $ hg merge
151 151 merging b
152 152 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
153 153 (branch merge, don't forget to commit)
154 154 $ hg ci -mmergeb -d '3 0'
155 155
156 156 annotate after merge
157 157
158 158 $ hg annotate -nf b
159 159 0 a: a
160 160 1 a: a
161 161 1 a: a
162 162 3 b: b4
163 163 4 b: c
164 164 3 b: b5
165 165
166 166 annotate after merge with -l
167 167
168 168 $ hg annotate -nlf b
169 169 0 a:1: a
170 170 1 a:2: a
171 171 1 a:3: a
172 172 3 b:4: b4
173 173 4 b:5: c
174 174 3 b:5: b5
175 175
176 176 $ hg up -C 1
177 177 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
178 178 $ hg cp a b
179 179 $ cat <<EOF > b
180 180 > a
181 181 > z
182 182 > a
183 183 > EOF
184 184 $ hg ci -mc -d '3 0'
185 185 created new head
186 186 $ hg merge
187 187 merging b
188 188 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
189 189 (branch merge, don't forget to commit)
190 190 $ cat <<EOF >> b
191 191 > b4
192 192 > c
193 193 > b5
194 194 > EOF
195 195 $ echo d >> b
196 196 $ hg ci -mmerge2 -d '4 0'
197 197
198 198 annotate after rename merge
199 199
200 200 $ hg annotate -nf b
201 201 0 a: a
202 202 6 b: z
203 203 1 a: a
204 204 3 b: b4
205 205 4 b: c
206 206 3 b: b5
207 207 7 b: d
208 208
209 209 annotate after rename merge with -l
210 210
211 211 $ hg annotate -nlf b
212 212 0 a:1: a
213 213 6 b:2: z
214 214 1 a:3: a
215 215 3 b:4: b4
216 216 4 b:5: c
217 217 3 b:5: b5
218 218 7 b:7: d
219 219
220 220 Issue2807: alignment of line numbers with -l
221 221
222 222 $ echo more >> b
223 223 $ hg ci -mmore -d '5 0'
224 224 $ echo more >> b
225 225 $ hg ci -mmore -d '6 0'
226 226 $ echo more >> b
227 227 $ hg ci -mmore -d '7 0'
228 228 $ hg annotate -nlf b
229 229 0 a: 1: a
230 230 6 b: 2: z
231 231 1 a: 3: a
232 232 3 b: 4: b4
233 233 4 b: 5: c
234 234 3 b: 5: b5
235 235 7 b: 7: d
236 236 8 b: 8: more
237 237 9 b: 9: more
238 238 10 b:10: more
239 239
240 240 linkrev vs rev
241 241
242 242 $ hg annotate -r tip -n a
243 243 0: a
244 244 1: a
245 245 1: a
246 246
247 247 linkrev vs rev with -l
248 248
249 249 $ hg annotate -r tip -nl a
250 250 0:1: a
251 251 1:2: a
252 252 1:3: a
253 253
254 254 Issue589: "undelete" sequence leads to crash
255 255
256 256 annotate was crashing when trying to --follow something
257 257
258 258 like A -> B -> A
259 259
260 260 generate ABA rename configuration
261 261
262 262 $ echo foo > foo
263 263 $ hg add foo
264 264 $ hg ci -m addfoo
265 265 $ hg rename foo bar
266 266 $ hg ci -m renamefoo
267 267 $ hg rename bar foo
268 268 $ hg ci -m renamebar
269 269
270 270 annotate after ABA with follow
271 271
272 272 $ hg annotate --follow foo
273 273 foo: foo
274 274
275 275 missing file
276 276
277 277 $ hg ann nosuchfile
278 278 abort: nosuchfile: no such file in rev e9e6b4fa872f
279 279 [255]
280 280
281 281 annotate file without '\n' on last line
282 282
283 283 $ printf "" > c
284 284 $ hg ci -A -m test -u nobody -d '1 0'
285 285 adding c
286 286 $ hg annotate c
287 287 $ printf "a\nb" > c
288 288 $ hg ci -m test
289 289 $ hg annotate c
290 290 [0-9]+: a (re)
291 291 [0-9]+: b (re)
292 292
293 293 Issue3841: check annotation of the file of which filelog includes
294 294 merging between the revision and its ancestor
295 295
296 296 to reproduce the situation with recent Mercurial, this script uses (1)
297 297 "hg debugsetparents" to merge without ancestor check by "hg merge",
298 298 and (2) the extension to allow filelog merging between the revision
299 299 and its ancestor by overriding "repo._filecommit".
300 300
301 301 $ cat > ../legacyrepo.py <<EOF
302 302 > from mercurial import node, util
303 303 > def reposetup(ui, repo):
304 304 > class legacyrepo(repo.__class__):
305 305 > def _filecommit(self, fctx, manifest1, manifest2,
306 306 > linkrev, tr, changelist):
307 307 > fname = fctx.path()
308 308 > text = fctx.data()
309 309 > flog = self.file(fname)
310 310 > fparent1 = manifest1.get(fname, node.nullid)
311 311 > fparent2 = manifest2.get(fname, node.nullid)
312 312 > meta = {}
313 313 > copy = fctx.renamed()
314 314 > if copy and copy[0] != fname:
315 315 > raise util.Abort('copying is not supported')
316 316 > if fparent2 != node.nullid:
317 317 > changelist.append(fname)
318 318 > return flog.add(text, meta, tr, linkrev,
319 319 > fparent1, fparent2)
320 320 > raise util.Abort('only merging is supported')
321 321 > repo.__class__ = legacyrepo
322 322 > EOF
323 323
324 324 $ cat > baz <<EOF
325 325 > 1
326 326 > 2
327 327 > 3
328 328 > 4
329 329 > 5
330 330 > EOF
331 331 $ hg add baz
332 332 $ hg commit -m "baz:0"
333 333
334 334 $ cat > baz <<EOF
335 335 > 1 baz:1
336 336 > 2
337 337 > 3
338 338 > 4
339 339 > 5
340 340 > EOF
341 341 $ hg commit -m "baz:1"
342 342
343 343 $ cat > baz <<EOF
344 344 > 1 baz:1
345 345 > 2 baz:2
346 346 > 3
347 347 > 4
348 348 > 5
349 349 > EOF
350 350 $ hg debugsetparents 17 17
351 351 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
352 352 $ hg debugindexdot .hg/store/data/baz.i
353 353 digraph G {
354 354 -1 -> 0
355 355 0 -> 1
356 356 1 -> 2
357 357 1 -> 2
358 358 }
359 359 $ hg annotate baz
360 360 17: 1 baz:1
361 361 18: 2 baz:2
362 362 16: 3
363 363 16: 4
364 364 16: 5
365 365
366 366 $ cat > baz <<EOF
367 367 > 1 baz:1
368 368 > 2 baz:2
369 369 > 3 baz:3
370 370 > 4
371 371 > 5
372 372 > EOF
373 373 $ hg commit -m "baz:3"
374 374
375 375 $ cat > baz <<EOF
376 376 > 1 baz:1
377 377 > 2 baz:2
378 378 > 3 baz:3
379 379 > 4 baz:4
380 380 > 5
381 381 > EOF
382 382 $ hg debugsetparents 19 18
383 383 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
384 384 $ hg debugindexdot .hg/store/data/baz.i
385 385 digraph G {
386 386 -1 -> 0
387 387 0 -> 1
388 388 1 -> 2
389 389 1 -> 2
390 390 2 -> 3
391 391 3 -> 4
392 392 2 -> 4
393 393 }
394 394 $ hg annotate baz
395 395 17: 1 baz:1
396 396 18: 2 baz:2
397 397 19: 3 baz:3
398 398 20: 4 baz:4
399 399 16: 5
400 400
401 401 annotate clean file
402 402
403 403 $ hg annotate -ncr "wdir()" foo
404 404 11 472b18db256d : foo
405 405
406 406 annotate modified file
407 407
408 408 $ echo foofoo >> foo
409 409 $ hg annotate -r "wdir()" foo
410 410 11 : foo
411 411 20+: foofoo
412 412
413 413 $ hg annotate -cr "wdir()" foo
414 414 472b18db256d : foo
415 415 b6bedd5477e7+: foofoo
416 416
417 417 $ hg annotate -ncr "wdir()" foo
418 418 11 472b18db256d : foo
419 419 20 b6bedd5477e7+: foofoo
420 420
421 421 $ hg annotate --debug -ncr "wdir()" foo
422 422 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
423 423 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
424 424
425 425 $ hg annotate -udr "wdir()" foo
426 426 test Thu Jan 01 00:00:00 1970 +0000: foo
427 427 test [A-Za-z0-9:+ ]+: foofoo (re)
428 428
429 429 $ hg annotate -ncr "wdir()" -Tjson foo
430 430 [
431 431 {
432 432 "line": "foo\n",
433 433 "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd",
434 434 "rev": 11
435 435 },
436 436 {
437 437 "line": "foofoo\n",
438 438 "node": null,
439 439 "rev": null
440 440 }
441 441 ]
442 442
443 443 annotate added file
444 444
445 445 $ echo bar > bar
446 446 $ hg add bar
447 447 $ hg annotate -ncr "wdir()" bar
448 448 20 b6bedd5477e7+: bar
449 449
450 450 annotate renamed file
451 451
452 452 $ hg rename foo renamefoo2
453 453 $ hg annotate -ncr "wdir()" renamefoo2
454 454 11 472b18db256d : foo
455 455 20 b6bedd5477e7+: foofoo
456 456
457 457 annotate missing file
458 458
459 459 $ rm baz
460 #if windows
461 $ hg annotate -ncr "wdir()" baz
462 abort: $TESTTMP\repo\baz: The system cannot find the file specified
463 [255]
464 #else
460 465 $ hg annotate -ncr "wdir()" baz
461 466 abort: No such file or directory: $TESTTMP/repo/baz
462 467 [255]
468 #endif
463 469
464 470 annotate removed file
465 471
466 472 $ hg rm baz
473 #if windows
474 $ hg annotate -ncr "wdir()" baz
475 abort: $TESTTMP\repo\baz: The system cannot find the file specified
476 [255]
477 #else
467 478 $ hg annotate -ncr "wdir()" baz
468 479 abort: No such file or directory: $TESTTMP/repo/baz
469 480 [255]
481 #endif
470 482
471 483 Test annotate with whitespace options
472 484
473 485 $ cd ..
474 486 $ hg init repo-ws
475 487 $ cd repo-ws
476 488 $ cat > a <<EOF
477 489 > aa
478 490 >
479 491 > b b
480 492 > EOF
481 493 $ hg ci -Am "adda"
482 494 adding a
483 495 $ sed 's/EOL$//g' > a <<EOF
484 496 > a a
485 497 >
486 498 > EOL
487 499 > b b
488 500 > EOF
489 501 $ hg ci -m "changea"
490 502
491 503 Annotate with no option
492 504
493 505 $ hg annotate a
494 506 1: a a
495 507 0:
496 508 1:
497 509 1: b b
498 510
499 511 Annotate with --ignore-space-change
500 512
501 513 $ hg annotate --ignore-space-change a
502 514 1: a a
503 515 1:
504 516 0:
505 517 0: b b
506 518
507 519 Annotate with --ignore-all-space
508 520
509 521 $ hg annotate --ignore-all-space a
510 522 0: a a
511 523 0:
512 524 1:
513 525 0: b b
514 526
515 527 Annotate with --ignore-blank-lines (similar to no options case)
516 528
517 529 $ hg annotate --ignore-blank-lines a
518 530 1: a a
519 531 0:
520 532 1:
521 533 1: b b
522 534
523 535 $ cd ..
524 536
525 537 Annotate with linkrev pointing to another branch
526 538 ------------------------------------------------
527 539
528 540 create history with a filerev whose linkrev points to another branch
529 541
530 542 $ hg init branchedlinkrev
531 543 $ cd branchedlinkrev
532 544 $ echo A > a
533 545 $ hg commit -Am 'contentA'
534 546 adding a
535 547 $ echo B >> a
536 548 $ hg commit -m 'contentB'
537 549 $ hg up --rev 'desc(contentA)'
538 550 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
539 551 $ echo unrelated > unrelated
540 552 $ hg commit -Am 'unrelated'
541 553 adding unrelated
542 554 created new head
543 555 $ hg graft -r 'desc(contentB)'
544 556 grafting 1:fd27c222e3e6 "contentB"
545 557 $ echo C >> a
546 558 $ hg commit -m 'contentC'
547 559 $ hg log -G
548 560 @ changeset: 4:072f1e8df249
549 561 | tag: tip
550 562 | user: test
551 563 | date: Thu Jan 01 00:00:00 1970 +0000
552 564 | summary: contentC
553 565 |
554 566 o changeset: 3:ff38df03cc4b
555 567 | user: test
556 568 | date: Thu Jan 01 00:00:00 1970 +0000
557 569 | summary: contentB
558 570 |
559 571 o changeset: 2:62aaf3f6fc06
560 572 | parent: 0:f0932f74827e
561 573 | user: test
562 574 | date: Thu Jan 01 00:00:00 1970 +0000
563 575 | summary: unrelated
564 576 |
565 577 | o changeset: 1:fd27c222e3e6
566 578 |/ user: test
567 579 | date: Thu Jan 01 00:00:00 1970 +0000
568 580 | summary: contentB
569 581 |
570 582 o changeset: 0:f0932f74827e
571 583 user: test
572 584 date: Thu Jan 01 00:00:00 1970 +0000
573 585 summary: contentA
574 586
575 587
576 588 Annotate should list ancestor of starting revision only
577 589
578 590 $ hg annotate a
579 591 0: A
580 592 3: B
581 593 4: C
582 594
583 595 Even when the starting revision is the linkrev-shadowed one:
584 596
585 597 $ hg annotate a -r 3
586 598 0: A
587 599 3: B
588 600
589 601 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now