diff mercurial/commands.py @ 45489:07c424a13811

grep: fix --follow with no --diff nor --rev to not fall back to plain grep Before, "grep --follow" would only print matches in the working directory. Since --follow is the option to specify the search space, it should disable the plain (i.e. wdir) grep.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 10 Sep 2020 13:30:34 +0900
parents 453bc6ca9ab2
children ac7a3da0dbb6
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Sep 11 12:39:45 2020 +0900
+++ b/mercurial/commands.py	Thu Sep 10 13:30:34 2020 +0900
@@ -3357,7 +3357,11 @@
         raise error.Abort(_(b'--diff and --all-files are mutually exclusive'))
     if opts.get(b'all_files') is None and not diff:
         opts[b'all_files'] = True
-    plaingrep = opts.get(b'all_files') and not opts.get(b'rev')
+    plaingrep = (
+        opts.get(b'all_files')
+        and not opts.get(b'rev')
+        and not opts.get(b'follow')
+    )
     all_files = opts.get(b'all_files')
     if plaingrep:
         opts[b'rev'] = [b'wdir()']