##// END OF EJS Templates
log: follow file history across copies even with -rREV (BC) (issue4959)...
Yuya Nishihara -
r35705:67893a51 default
parent child Browse files
Show More
@@ -2322,9 +2322,11 b' def walkchangerevs(repo, match, opts, pr'
2322
2322
2323 return iterate()
2323 return iterate()
2324
2324
2325 def _makelogmatcher(repo, pats, opts):
2325 def _makelogmatcher(repo, revs, pats, opts):
2326 """Build matcher and expanded patterns from log options
2326 """Build matcher and expanded patterns from log options
2327
2327
2328 If --follow, revs are the revisions to follow from.
2329
2328 Returns (match, pats, slowpath) where
2330 Returns (match, pats, slowpath) where
2329 - match: a matcher built from the given pats and -I/-X opts
2331 - match: a matcher built from the given pats and -I/-X opts
2330 - pats: patterns used (globs are expanded on Windows)
2332 - pats: patterns used (globs are expanded on Windows)
@@ -2339,8 +2341,17 b' def _makelogmatcher(repo, pats, opts):'
2339 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2341 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
2340 if not slowpath:
2342 if not slowpath:
2341 follow = opts.get('follow') or opts.get('follow_first')
2343 follow = opts.get('follow') or opts.get('follow_first')
2344 startctxs = []
2345 if follow and opts.get('rev'):
2346 startctxs = [repo[r] for r in revs]
2342 for f in match.files():
2347 for f in match.files():
2343 if follow and f not in wctx:
2348 if follow and startctxs:
2349 # No idea if the path was a directory at that revision, so
2350 # take the slow path.
2351 if any(f not in c for c in startctxs):
2352 slowpath = True
2353 continue
2354 elif follow and f not in wctx:
2344 # If the file exists, it may be a directory, so let it
2355 # If the file exists, it may be a directory, so let it
2345 # take the slow path.
2356 # take the slow path.
2346 if os.path.exists(repo.wjoin(f)):
2357 if os.path.exists(repo.wjoin(f)):
@@ -2518,17 +2529,13 b' def getlogrevs(repo, pats, opts):'
2518 """
2529 """
2519 follow = opts.get('follow') or opts.get('follow_first')
2530 follow = opts.get('follow') or opts.get('follow_first')
2520 followfirst = opts.get('follow_first')
2531 followfirst = opts.get('follow_first')
2521 if opts.get('rev'):
2522 # TODO: do not mutate opts here
2523 opts.pop('follow', None)
2524 opts.pop('follow_first', None)
2525 limit = loglimit(opts)
2532 limit = loglimit(opts)
2526 revs = _logrevs(repo, opts)
2533 revs = _logrevs(repo, opts)
2527 if not revs:
2534 if not revs:
2528 return smartset.baseset(), None
2535 return smartset.baseset(), None
2529 match, pats, slowpath = _makelogmatcher(repo, pats, opts)
2536 match, pats, slowpath = _makelogmatcher(repo, revs, pats, opts)
2530 if follow:
2537 if follow:
2531 if opts.get('rev') or slowpath or not pats:
2538 if slowpath or not pats:
2532 revs = dagop.revancestors(repo, revs, followfirst=followfirst)
2539 revs = dagop.revancestors(repo, revs, followfirst=followfirst)
2533 else:
2540 else:
2534 revs = _fileancestors(repo, revs, match, followfirst)
2541 revs = _fileancestors(repo, revs, match, followfirst)
@@ -95,7 +95,7 b' o (0) root'
95 > revs = cmdutil._logrevs(repo, opts)
95 > revs = cmdutil._logrevs(repo, opts)
96 > if not revs:
96 > if not revs:
97 > return None
97 > return None
98 > match, pats, slowpath = cmdutil._makelogmatcher(repo, pats, opts)
98 > match, pats, slowpath = cmdutil._makelogmatcher(repo, revs, pats, opts)
99 > return cmdutil._makelogrevset(repo, match, pats, slowpath, opts)[0]
99 > return cmdutil._makelogrevset(repo, match, pats, slowpath, opts)[0]
100 >
100 >
101 > def uisetup(ui):
101 > def uisetup(ui):
@@ -465,6 +465,104 b' log -vf dir/b'
465 2
465 2
466 0
466 0
467
467
468 follow files from the specified revisions (issue4959)
469
470 $ hg log -G -T '{rev} {files},{file_copies % " {source}->{name}"}\n'
471 @ 4 dir/b e, dir/b->e
472 |
473 o 3 a b d g, a->b f->g
474 |
475 o 2 b dir/b f g, b->dir/b
476 |
477 o 1 b g, a->b f->g
478 |
479 o 0 a f,
480
481
482 $ hg log -T '{rev}\n' -fr 4 e
483 4
484 2
485 1
486 0
487 $ hg log -T '{rev}\n' -fr 2 g
488 2
489 1
490 0
491 $ hg log -T '{rev}\n' -fr '2+3' g
492 3
493 2
494 1
495 0
496
497 follow files from the specified revisions with glob patterns (issue5053)
498 (BROKEN: should follow copies from e@4)
499
500 $ hg log -T '{rev}\n' -fr4 e -X '[abcdfg]'
501 4
502 2 (false !)
503 1 (false !)
504 0 (false !)
505
506 follow files from the specified revisions with missing patterns
507 (BROKEN: should follow copies from e@4)
508
509 $ hg log -T '{rev}\n' -fr4 e x
510 4
511 2 (false !)
512 1 (false !)
513 0 (false !)
514
515 follow files from the specified revisions across copies with -p/--patch
516
517 $ hg log -T '== rev: {rev},{file_copies % " {source}->{name}"} ==\n' -fpr 4 e g
518 == rev: 4, dir/b->e ==
519 diff -r 2ca5ba701980 -r 7e4639b4691b e
520 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
521 +++ b/e Thu Jan 01 00:00:05 1970 +0000
522 @@ -0,0 +1,1 @@
523 +a
524
525 == rev: 3, a->b f->g ==
526 diff -r f8954cd4dc1f -r 2ca5ba701980 g
527 --- a/g Thu Jan 01 00:00:03 1970 +0000
528 +++ b/g Thu Jan 01 00:00:04 1970 +0000
529 @@ -1,2 +1,2 @@
530 f
531 -g
532 +f
533
534 == rev: 2, b->dir/b ==
535 diff -r d89b0a12d229 -r f8954cd4dc1f dir/b
536 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
537 +++ b/dir/b Thu Jan 01 00:00:03 1970 +0000
538 @@ -0,0 +1,1 @@
539 +a
540 diff -r d89b0a12d229 -r f8954cd4dc1f f
541 --- a/f Thu Jan 01 00:00:02 1970 +0000
542 +++ b/f Thu Jan 01 00:00:03 1970 +0000
543 @@ -1,1 +1,2 @@
544 f
545 +f
546
547 == rev: 1, a->b f->g ==
548 diff -r 9161b9aeaf16 -r d89b0a12d229 b
549 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
550 +++ b/b Thu Jan 01 00:00:02 1970 +0000
551 @@ -0,0 +1,1 @@
552 +a
553
554 == rev: 0, ==
555 diff -r 000000000000 -r 9161b9aeaf16 a
556 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
557 +++ b/a Thu Jan 01 00:00:01 1970 +0000
558 @@ -0,0 +1,1 @@
559 +a
560 diff -r 000000000000 -r 9161b9aeaf16 f
561 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
562 +++ b/f Thu Jan 01 00:00:01 1970 +0000
563 @@ -0,0 +1,1 @@
564 +f
565
468
566
469 log copies with --copies
567 log copies with --copies
470
568
@@ -1725,11 +1823,6 b' Also check when maxrev < lastrevfilelog'
1725 date: Thu Jan 01 00:00:00 1970 +0000
1823 date: Thu Jan 01 00:00:00 1970 +0000
1726 summary: add foo, related
1824 summary: add foo, related
1727
1825
1728 changeset: 2:c4c64aedf0f7
1729 user: test
1730 date: Thu Jan 01 00:00:00 1970 +0000
1731 summary: add unrelated old foo
1732
1733 $ cd ..
1826 $ cd ..
1734
1827
1735 Issue2383: hg log showing _less_ differences than hg diff
1828 Issue2383: hg log showing _less_ differences than hg diff
General Comments 0
You need to be logged in to leave comments. Login now