diff mercurial/patch.py @ 10729:7a5931c5f2dc stable

patch: enhance diff detection regexp, allow '--- ' in patch message
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 18 Mar 2010 18:22:34 +0100
parents 3212afb33116
children 71cf11f03b3d a528a1046dba
line wrap: on
line diff
--- a/mercurial/patch.py	Thu Mar 18 16:38:07 2010 +0100
+++ b/mercurial/patch.py	Thu Mar 18 18:22:34 2010 +0100
@@ -178,7 +178,8 @@
     # (this heuristic is borrowed from quilt)
     diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
                         r'retrieving revision [0-9]+(\.[0-9]+)*$|'
-                        r'(---|\*\*\*)[ \t])', re.MULTILINE)
+                        r'(---|\*\*\*)[ \t].*?'
+                        r'^(\+\+\+|\*\*\*)[ \t])', re.MULTILINE|re.DOTALL)
 
     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
     tmpfp = os.fdopen(fd, 'w')