diff -r bba730d7a6f4 -r 0356b41fe01d mercurial/commands.py --- a/mercurial/commands.py Thu Sep 10 17:14:03 2020 +0900 +++ b/mercurial/commands.py Thu Sep 10 18:01:43 2020 +0900 @@ -3579,7 +3579,6 @@ skip = set() revfiles = {} - match = scmutil.match(repo[None], pats, opts) found = False follow = opts.get(b'follow') @@ -3654,9 +3653,21 @@ if pfn not in matches[parent] and pfn in pctx: grepbody(pfn, parent, readfile(pctx, pfn)) + wopts = logcmdutil.walkopts( + pats=pats, + opts=opts, + revspec=opts[b'rev'], + include_pats=opts[b'include'], + exclude_pats=opts[b'exclude'], + follow=follow, + force_changelog_traversal=all_files, + filter_revisions_by_pats=not all_files, + ) + revs, makefilematcher = logcmdutil.makewalker(repo, wopts) + ui.pager(b'grep') fm = ui.formatter(b'grep', opts) - for ctx in cmdutil.walkchangerevs(repo, match, opts, prep): + for ctx in cmdutil.walkchangerevs(repo, revs, makefilematcher, prep): rev = ctx.rev() parent = ctx.p1().rev() for fn in sorted(revfiles.get(rev, [])):