# HG changeset patch # User Matt Mackall # Date 2012-01-03 21:48:58 # Node ID 1ef46bcd76f800776c9582e1eb27a03374e9d8b1 # Parent c8cd3c4bf9a41a4e8c6e36568e77e4d8d39b2be0 grep: make multiline mode the default (BC) This is a much more logical way to deal with ^ and $. Old ^ and $ behavior are available with \A and \Z. 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