# HG changeset patch # User Yuya Nishihara # Date 2020-09-10 09:40:01 # Node ID 9fead7d97069f0e2b6c0e285f1d5c45876a069bc # Parent 1efbc787334c1f985af7211162fc088c1e469605 grep: add option for logcmdutil.makewalker() to not filter revs by file pats This is needed to implement "grep --all-files". diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -711,6 +711,10 @@ class walkopts(object): # include revisions where files were removed force_changelog_traversal = attr.ib(default=False) # type: bool + # filter revisions by file patterns, which should be disabled only if + # you want to include revisions where files were unmodified + filter_revisions_by_pats = attr.ib(default=True) # type: bool + # sort revisions prior to traversal: 'desc', 'topo', or None sort_revisions = attr.ib(default=None) # type: Optional[bytes] @@ -902,7 +906,7 @@ def _makerevset(repo, wopts, slowpath): b'user': wopts.users, } - if slowpath: + if wopts.filter_revisions_by_pats and slowpath: # See walkchangerevs() slow path. # # pats/include/exclude cannot be represented as separate @@ -919,7 +923,7 @@ def _makerevset(repo, wopts, slowpath): for p in wopts.exclude_pats: matchargs.append(b'x:' + p) opts[b'_matchfiles'] = matchargs - elif not wopts.follow: + elif wopts.filter_revisions_by_pats and not wopts.follow: opts[b'_patslog'] = list(wopts.pats) expr = []