diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3679,7 +3679,7 @@ def grep(ui, repo, pattern, *pats, **opt wopts = logcmdutil.walkopts( pats=pats, - opts=opts, + opts=pycompat.byteskwargs(opts), revspec=opts['rev'], include_pats=opts['include'], exclude_pats=opts['exclude'], diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -525,6 +525,23 @@ Test wdir 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