diff mercurial/patch.py @ 10883:196908117c27 stable

patch: don't look for headers in diff lines If you have a diff line that matches a header line, the patch splitter currently breaks your patch at this line. For example a line like: +key: value This can lead to "malformed patch" exceptions. Now fixed.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Fri, 09 Apr 2010 20:34:05 +0200
parents fb06e357e698
children 4fb1bafd43e7
line wrap: on
line diff
--- a/mercurial/patch.py	Fri Apr 09 15:14:43 2010 +0200
+++ b/mercurial/patch.py	Fri Apr 09 20:34:05 2010 +0200
@@ -47,6 +47,9 @@
         if inheader and line[0] in (' ', '\t'):
             # continuation
             return True
+        if line[0] in (' ', '-', '+'):
+            # diff line - don't check for header pattern in there
+            return False
         l = line.split(': ', 1)
         return len(l) == 2 and ' ' not in l[0]