grep: make multiline mode the default (BC) stable
authorMatt Mackall <mpm@selenic.com>
Tue, 03 Jan 2012 15:48:58 -0600
branchstable
changeset 15765 1ef46bcd76f8
parent 15764 c8cd3c4bf9a4
child 15770 1f9f9b4c2923
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.
mercurial/commands.py
tests/test-grep.t
--- 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