diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2663,7 +2663,7 @@ def grep(ui, repo, pattern, *pats, **opt Returns 0 if a match is found, 1 otherwise. """ - reflags = 0 + reflags = re.M if opts.get('ignore_case'): reflags |= re.I try: diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -59,8 +59,9 @@ other follow - $ hg grep --traceback -f 'import$' port2 + $ hg grep --traceback -f 'import\n\Z' port2 port:0:import + $ echo deport >> port2 $ hg commit -m 5 -u eggs -d '6 0' $ hg grep -f --all -nu port port2