# HG changeset patch # User Martin Geisler # Date 1233777218 -3600 # Node ID fb0776fe3e38ea579a06ecd061ec1b3697b6b9f4 # Parent 2e48668b51f0f38f1225bd5c6f8210959f972d25 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. diff -r 2e48668b51f0 -r fb0776fe3e38 mercurial/patch.py --- 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')