changeset 15765:1ef46bcd76f8 stable

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.
author Matt Mackall <mpm@selenic.com>
date Tue, 03 Jan 2012 15:48:58 -0600
parents c8cd3c4bf9a4
children 1f9f9b4c2923
files mercurial/commands.py tests/test-grep.t
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Jan 02 20:52:16 2012 -0600
+++ b/mercurial/commands.py	Tue Jan 03 15:48:58 2012 -0600
@@ -2663,7 +2663,7 @@
 
     Returns 0 if a match is found, 1 otherwise.
     """
-    reflags = 0
+    reflags = re.M
     if opts.get('ignore_case'):
         reflags |= re.I
     try:
--- a/tests/test-grep.t	Mon Jan 02 20:52:16 2012 -0600
+++ b/tests/test-grep.t	Tue Jan 03 15:48:58 2012 -0600
@@ -59,8 +59,9 @@
 
 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