comparison tests/test-log.t @ 45473:5f0eeda2005d

log: make -frREV PATH detect missing files before falling back to slow path If -rREV isn't specified, "log --follow" would abort on nonexistent paths. Let's implement this behavior for "-frREV" case as we have ctx.hasdir() now. Otherwise "log -frREV PATH" would silently fall back to slow path and files wouldn't be followed across renames. The loop is quadratic (as before), but the size of the startctxs and match.files() should be small in general. Some tests are marked as BROKEN since file renames aren't tracked in the slow path. This is a known limitation of the current history traversal function.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 12 Sep 2020 07:23:47 +0900
parents 07324227f6b7
children ed84a4d48910
comparison
equal deleted inserted replaced
45472:07324227f6b7 45473:5f0eeda2005d
502 2 (false !) 502 2 (false !)
503 1 (false !) 503 1 (false !)
504 0 (false !) 504 0 (false !)
505 505
506 follow files from the specified revisions with missing patterns 506 follow files from the specified revisions with missing patterns
507 (BROKEN: should follow copies from e@4)
508 507
509 $ hg log -T '{rev}\n' -fr4 e x 508 $ hg log -T '{rev}\n' -fr4 e x
510 4 509 abort: cannot follow file not in any of the specified revisions: "x"
511 2 (false !) 510 [255]
511
512 follow files from the specified revisions with directory patterns
513 (BROKEN: should follow copies from dir/b@2)
514
515 $ hg log -T '{rev}\n' -fr2 dir/b dir
516 2
512 1 (false !) 517 1 (false !)
513 0 (false !) 518 0 (false !)
519
520 follow files from multiple revisions, but the pattern is missing in
521 one of the specified revisions
522
523 $ hg log -T '{rev}\n' -fr'2+4' dir/b e
524 e: no such file in rev f8954cd4dc1f
525 dir/b: no such file in rev 7e4639b4691b
526 4
527 2
528 1
529 0
530
531 follow files from multiple revisions, and the pattern matches a file in
532 one revision but matches a directory in another:
533 (BROKEN: should follow copies from dir/b@2 and dir/b/g@5)
534 (BROKEN: the revision 4 should not be included since dir/b/g@5 is unchanged)
535
536 $ mkdir -p dir/b
537 $ hg mv g dir/b
538 $ hg ci -m 'make dir/b a directory'
539
540 $ hg log -T '{rev}\n' -fr'2+5' dir/b
541 5
542 4
543 3 (false !)
544 2
545 1 (false !)
546 0 (false !)
547
548 $ hg --config extensions.strip= strip -r. --no-backup
549 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
514 550
515 follow files from the specified revisions across copies with -p/--patch 551 follow files from the specified revisions across copies with -p/--patch
516 552
517 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g 553 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g
518 == rev: 4, dir/b->e == 554 == rev: 4, dir/b->e ==
2310 d1/f1 | 1 + 2346 d1/f1 | 1 +
2311 1 files changed, 1 insertions(+), 0 deletions(-) 2347 1 files changed, 1 insertions(+), 0 deletions(-)
2312 2348
2313 2349
2314 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound 2350 $ hg log -T '== {rev} ==\n' -fr'wdir()' --git --stat notfound
2315 notfound: $ENOENT$ 2351 abort: cannot follow file not in any of the specified revisions: "notfound"
2352 [255]
2353
2354 follow files from wdir and non-wdir revision:
2355
2356 $ hg log -T '{rev}\n' -fr'wdir()+.' f1-copy
2357 f1-copy: no such file in rev 65624cd9070a
2358 2147483647
2359 0
2316 2360
2317 follow added/removed files from wdir parent 2361 follow added/removed files from wdir parent
2318 2362
2319 $ hg log -T '{rev}\n' -f d1/f2 2363 $ hg log -T '{rev}\n' -f d1/f2
2320 abort: cannot follow nonexistent file: "d1/f2" 2364 abort: cannot follow nonexistent file: "d1/f2"