]> git.ozlabs.org Git - patchwork/commitdiff
[parser] Don't remove --- update lines
authorJeremy Kerr <jk@ozlabs.org>
Sat, 20 Sep 2008 00:30:05 +0000 (10:30 +1000)
committerJeremy Kerr <jk@ozlabs.org>
Sat, 20 Sep 2008 00:30:05 +0000 (10:30 +1000)
We'd like to keep update lines in the patch comments, so change the
signature-removal code to allow them to pass through.

Also, add appropriate tests.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/bin/parsemail.py
apps/patchwork/tests/patchparser.py

index 1f213933a1e094c782de5f1564357df685fd847f..b0f1497656ab8ac4170c93f34975454b4f9b0fad 100755 (executable)
@@ -298,8 +298,9 @@ def clean_subject(subject, drop_prefixes = None):
 
     return subject
 
-sig_re = re.compile('^(-{2,3} ?|_+)\n.*', re.S | re.M)
+sig_re = re.compile('^(-|_+)\n.*', re.S | re.M)
 def clean_content(str):
+    """ Try to remove signature (-- ) and list footer (_____) cruft """
     str = sig_re.sub('', str)
     return str.strip()
 
index 3b10ef5166808ae7006224fbfb0330e59d06c201..2e207bf7e9ec781a1ebb88f3b2b99146e86d503f 100644 (file)
@@ -102,3 +102,27 @@ class SignatureCommentTest(InlinePatchTest):
                 '-- \nsig\n' + self.orig_patch)
         (self.patch, self.comment) = find_content(self.project, email)
 
+
+class ListFooterTest(InlinePatchTest):
+    patch_filename = '0001-add-line.patch'
+    test_comment = 'Test comment\nmore comment'
+
+    def setUp(self):
+        self.orig_patch = self.read_patch(self.patch_filename)
+        email = self.create_email( \
+                self.test_comment + '\n' + \
+                '_______________________________________________\n' + \
+                'Linuxppc-dev mailing list\n' + \
+                self.orig_patch)
+        (self.patch, self.comment) = find_content(self.project, email)
+
+
+class UpdateCommentTest(InlinePatchTest):
+    """ Test for '---\nUpdate: v2' style comments to patches. """
+    patch_filename = '0001-add-line.patch'
+    test_comment = 'Test comment\nmore comment\n---\nUpdate: test update'
+
+class UpdateSigCommentTest(SignatureCommentTest):
+    """ Test for '---\nUpdate: v2' style comments to patches, with a sig """
+    patch_filename = '0001-add-line.patch'
+    test_comment = 'Test comment\nmore comment\n---\nUpdate: test update'