Show More
@@ -692,13 +692,27 b' def _makematcher(repo, revs, pats, opts)' | |||||
692 | if not slowpath: |
|
692 | if not slowpath: | |
693 | follow = opts.get(b'follow') or opts.get(b'follow_first') |
|
693 | follow = opts.get(b'follow') or opts.get(b'follow_first') | |
694 | if follow and opts.get(b'rev'): |
|
694 | if follow and opts.get(b'rev'): | |
|
695 | # There may be the case that a path doesn't exist in some (but | |||
|
696 | # not all) of the specified start revisions, but let's consider | |||
|
697 | # the path is valid. Missing files will be warned by the matcher. | |||
695 | startctxs = [repo[r] for r in revs] |
|
698 | startctxs = [repo[r] for r in revs] | |
696 | for f in match.files(): |
|
699 | for f in match.files(): | |
697 | # No idea if the path was a directory at that revision, so |
|
700 | found = False | |
|
701 | for c in startctxs: | |||
|
702 | if f in c: | |||
|
703 | found = True | |||
|
704 | elif c.hasdir(f): | |||
|
705 | # If a directory exists in any of the start revisions, | |||
698 | # take the slow path. |
|
706 | # take the slow path. | |
699 | if any(f not in c for c in startctxs): |
|
707 | found = slowpath = True | |
700 |
|
|
708 | if not found: | |
701 |
|
|
709 | raise error.Abort( | |
|
710 | _( | |||
|
711 | b'cannot follow file not in any of the specified ' | |||
|
712 | b'revisions: "%s"' | |||
|
713 | ) | |||
|
714 | % f | |||
|
715 | ) | |||
702 | elif follow: |
|
716 | elif follow: | |
703 | for f in match.files(): |
|
717 | for f in match.files(): | |
704 | if f not in wctx: |
|
718 | if f not in wctx: |
@@ -504,14 +504,50 b' follow files from the specified revision' | |||||
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 !) | |
514 |
|
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 | |||
|
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 | |
@@ -2312,7 +2348,15 b' follow files from wdir' | |||||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now