]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/bin/parsemail.py
parser: allow other protocol types in pull-request handling
[patchwork] / apps / patchwork / bin / parsemail.py
index 2a4df3868f1257fa129406b0565764d46fb5f373..52c85fe362bbe27fea1542061f899060b85c9623 100755 (executable)
@@ -140,7 +140,7 @@ def mail_headers(mail):
 def find_pull_request(content):
     git_re = re.compile('^The following changes since commit.*' +
                         '^are available in the git repository at:\n'
-                        '^\s*(git://[^\n]+)$',
+                        '^\s*([\S]+://[^\n]+)$',
                            re.DOTALL | re.MULTILINE)
     match = git_re.search(content)
     if match:
@@ -185,15 +185,9 @@ def find_content(project, mail):
     patch = None
     comment = None
 
-    if patchbuf:
-        mail_headers(mail)
+    if pullurl or patchbuf:
         name = clean_subject(mail.get('Subject'), [project.linkname])
-        patch = Patch(name = name, content = patchbuf,
-                    date = mail_date(mail), headers = mail_headers(mail))
-
-    if pullurl:
-        name = clean_subject(mail.get('Subject'), [project.linkname])
-        patch = Patch(name = name, pull_url = pullurl,
+        patch = Patch(name = name, pull_url = pullurl, content = patchbuf,
                     date = mail_date(mail), headers = mail_headers(mail))
 
     if commentbuf: