3652 if diff: |
3651 if diff: |
3653 pfn = copy or fn |
3652 pfn = copy or fn |
3654 if pfn not in matches[parent] and pfn in pctx: |
3653 if pfn not in matches[parent] and pfn in pctx: |
3655 grepbody(pfn, parent, readfile(pctx, pfn)) |
3654 grepbody(pfn, parent, readfile(pctx, pfn)) |
3656 |
3655 |
|
3656 wopts = logcmdutil.walkopts( |
|
3657 pats=pats, |
|
3658 opts=opts, |
|
3659 revspec=opts[b'rev'], |
|
3660 include_pats=opts[b'include'], |
|
3661 exclude_pats=opts[b'exclude'], |
|
3662 follow=follow, |
|
3663 force_changelog_traversal=all_files, |
|
3664 filter_revisions_by_pats=not all_files, |
|
3665 ) |
|
3666 revs, makefilematcher = logcmdutil.makewalker(repo, wopts) |
|
3667 |
3657 ui.pager(b'grep') |
3668 ui.pager(b'grep') |
3658 fm = ui.formatter(b'grep', opts) |
3669 fm = ui.formatter(b'grep', opts) |
3659 for ctx in cmdutil.walkchangerevs(repo, match, opts, prep): |
3670 for ctx in cmdutil.walkchangerevs(repo, revs, makefilematcher, prep): |
3660 rev = ctx.rev() |
3671 rev = ctx.rev() |
3661 parent = ctx.p1().rev() |
3672 parent = ctx.p1().rev() |
3662 for fn in sorted(revfiles.get(rev, [])): |
3673 for fn in sorted(revfiles.get(rev, [])): |
3663 states = matches[rev][fn] |
3674 states = matches[rev][fn] |
3664 copy = copies.get(rev, {}).get(fn) |
3675 copy = copies.get(rev, {}).get(fn) |