[yocto] [patchwork][PATCH] patchwork/bin/parsemail: Improve new patch filtering

Jose Lamego jose.a.lamego at linux.intel.com
Wed Jan 11 09:01:19 PST 2017


From: Jose Lamego <jose.a.lamego at intel.com>

Patchwork may incorrectly identify emails containing patch-like content or
that are replies/forwards from a previous message as patches, thus wrongly
creating a new series revision.
This change makes "[PATCH" prefix in subject mandatory for emails to be
considered as possible new patches, and makes any email with a subject
starting with any character other than a square bracket ("[") to be handled
as a possible comment to an existing patch.

[YOCTO #10764]
[YOCTO #10877]

Signed-off-by: Jose Lamego <jose.a.lamego at intel.com>
---

Notes:
    v2 renamed to reflect that the subject filtering now includes ruling-out emails with a Subject header not starting with the expected square bracket

 patchwork/bin/parsemail.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py
index 1c2c774..94c7669 100755
--- a/patchwork/bin/parsemail.py
+++ b/patchwork/bin/parsemail.py
@@ -399,7 +399,8 @@ def find_content(project, mail):
     refs = build_references_list(mail)
     is_root = refs == []
     is_cover_letter = is_root and x == 0
-    is_patch = patchbuf is not None
+    patch_prefix = re.match('(\s*\[[^]]*\]\s*)*\[\s*PATCH', mail.get('Subject'))
+    is_patch = patchbuf is not None and patch_prefix
 
     drop_patch = not is_attachment and \
         project.git_send_email_only and not is_git_send_email(mail)
-- 
1.9.1




More information about the yocto mailing list