grep: restore usage of --include/--exclude options stable
authorJordi Gutiérrez Hermoso <jordigh@octave.org>
Thu, 01 Feb 2024 19:35:35 -0500
branchstable
changeset 51364 c6560ee526d2
parent 51363 d626e5e7bbbe
child 51365 ded1bad5653d
grep: restore usage of --include/--exclude options The refactor in 4a73df6eb67d accidentally forgot to transform the opts argument for walkopts into a byteskwargs. This resulted in its options being ignored. In particular, the -X/-I pair of options was missing. A simple fix restores its usage. Tests included, of course.
mercurial/commands.py
tests/test-grep.t
--- a/mercurial/commands.py	Tue Jan 30 22:14:02 2024 +0000
+++ b/mercurial/commands.py	Thu Feb 01 19:35:35 2024 -0500
@@ -3679,7 +3679,7 @@
 
     wopts = logcmdutil.walkopts(
         pats=pats,
-        opts=opts,
+        opts=pycompat.byteskwargs(opts),
         revspec=opts['rev'],
         include_pats=opts['include'],
         exclude_pats=opts['exclude'],
--- a/tests/test-grep.t	Tue Jan 30 22:14:02 2024 +0000
+++ b/tests/test-grep.t	Thu Feb 01 19:35:35 2024 -0500
@@ -525,6 +525,23 @@
   port2:2147483647:deport
   port2:2147483647:wport
 
+Testing include/exclude
+
+  $ hg cp port tort
+  $ hg grep port -X tort
+  port:export
+  port:vaportight
+  port:import/export
+  port2:export
+  port2:vaportight
+  port2:import/export
+  port2:deport
+  port2:wport
+  $ hg grep port -I tort
+  tort:export
+  tort:vaportight
+  tort:import/export
+
   $ cd ..
   $ hg init t2
   $ cd t2