changeset 7729: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 2e48668b51f0
children 26bdb7109170
files mercurial/patch.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -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')