@@ -183,15 +183,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:
@@ -333,3 +333,18 @@ class GitPullTest(PatchTest):
self.assertTrue(patch.pull_url is not None)
self.assertTrue(patch.content is None)
self.assertTrue(comment is not None)
+
+ def testGitPullRequestWithDiff(self):
+ mail = read_mail('0002-git-pull-request-with-diff.mbox',
+ project = self.project)
+ (patch, comment) = find_content(self.project, mail)
+ self.assertTrue(patch is not None)
+ self.assertEqual(
+ ('git://git.kernel.org/pub/scm/linux/kernel/git/tip/'
+ 'linux-2.6-tip.git x86-fixes-for-linus'),
+ patch.pull_url)
+ self.assertTrue(
+ patch.content.startswith(
+ 'diff --git a/arch/x86/include/asm/smp.h'),
+ patch.content)
+ self.assertTrue(comment is not None)
Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> --- This patch makes sure we don't throw away the diff of pull requests. Since I didn't have the mbox file of a pull request handy I copied the existing one and tweaked it so that I could use it for my test. Hope that's ok. apps/patchwork/bin/parsemail.py | 10 ++-------- apps/patchwork/tests/patchparser.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 8 deletions(-)