changeset 45647:9fead7d97069

grep: add option for logcmdutil.makewalker() to not filter revs by file pats This is needed to implement "grep --all-files".
author Yuya Nishihara <yuya@tcha.org>
date Thu, 10 Sep 2020 18:40:01 +0900
parents 1efbc787334c
children 3a024d7cd08e
files mercurial/logcmdutil.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/logcmdutil.py	Thu Oct 01 09:48:41 2020 +0200
+++ b/mercurial/logcmdutil.py	Thu Sep 10 18:40:01 2020 +0900
@@ -711,6 +711,10 @@
     # 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 @@
         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 @@
         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 = []