diff mercurial/patch.py @ 7736:fb0776fe3e38

patch: turned strings with backslashes into raw strings In Python, the backslash in an unrecognized escape sequence is left behind, which makes '\.' the same as r'\.'. Relying on this feature is quite brittle, IMHO. Removed unnecessary string concatenation as well.
author Martin Geisler <mg@daimi.au.dk>
date Wed, 04 Feb 2009 20:53:38 +0100
parents e5f445c94226
children edcb56991afe
line wrap: on
line diff
--- a/mercurial/patch.py	Tue Feb 03 21:38:36 2009 +0100
+++ b/mercurial/patch.py	Wed Feb 04 20:53:38 2009 +0100
@@ -52,9 +52,9 @@
 
     # attempt to detect the start of a patch
     # (this heuristic is borrowed from quilt)
-    diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |' +
-                        'retrieving revision [0-9]+(\.[0-9]+)*$|' +
-                        '(---|\*\*\*)[ \t])', re.MULTILINE)
+    diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |'
+                        r'retrieving revision [0-9]+(\.[0-9]+)*$|'
+                        r'(---|\*\*\*)[ \t])', re.MULTILINE)
 
     fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
     tmpfp = os.fdopen(fd, 'w')