[PATCH v2 06/10] parser: Ensure consistent use of 'parse_'
Stephen Finucane
stephenfinucane at hotmail.com
Mon Aug 22 04:09:06 AEST 2016
From: Stephen Finucane <stephen.finucane at intel.com>
Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
Reviewed-by: Andy Doan <andy.doan at linaro.org>
---
patchwork/parser.py | 24 ++++++++++++------------
patchwork/tests/test_parser.py | 6 +++---
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/patchwork/parser.py b/patchwork/parser.py
index 41694ca..cadfe74 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -159,17 +159,6 @@ def find_headers(mail):
for (k, v) in list(mail.items())])
-def find_pull_request(content):
- git_re = re.compile(r'^The following changes since commit.*' +
- r'^are available in the git repository at:\n'
- r'^\s*([\S]+://[^\n]+)$',
- re.DOTALL | re.MULTILINE)
- match = git_re.search(content)
- if match:
- return match.group(1)
- return None
-
-
def find_references(mail):
"""Construct a list of possible reply message ids."""
refs = []
@@ -527,6 +516,17 @@ def parse_patch(content):
return patchbuf, commentbuf
+def parse_pull_request(content):
+ git_re = re.compile(r'^The following changes since commit.*' +
+ r'^are available in the git repository at:\n'
+ r'^\s*([\S]+://[^\n]+)$',
+ re.DOTALL | re.MULTILINE)
+ match = git_re.search(content)
+ if match:
+ return match.group(1)
+ return None
+
+
def find_state(mail):
"""Return the state with the given name or the default."""
state_name = mail.get('X-Patchwork-State', '').strip()
@@ -623,7 +623,7 @@ def parse_mail(mail, list_id=None):
refs = find_references(mail)
date = find_date(mail)
headers = find_headers(mail)
- pull_url = find_pull_request(message)
+ pull_url = parse_pull_request(message)
# build objects
diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py
index 02845fb..5e94400 100644
--- a/patchwork/tests/test_parser.py
+++ b/patchwork/tests/test_parser.py
@@ -34,8 +34,8 @@ from patchwork.parser import clean_subject
from patchwork.parser import find_author
from patchwork.parser import find_content
from patchwork.parser import find_project_by_header
-from patchwork.parser import find_pull_request
from patchwork.parser import parse_mail as _parse_mail
+from patchwork.parser import parse_pull_request
from patchwork.parser import parse_series_marker
from patchwork.parser import split_prefixes
from patchwork.tests.utils import create_project
@@ -432,7 +432,7 @@ class PatchParseTest(PatchTest):
def _test_pull_request_parse(self, mbox_filename):
diff, message = self._find_content(mbox_filename)
- pull_url = find_pull_request(message)
+ pull_url = parse_pull_request(message)
self.assertTrue(diff is None)
self.assertTrue(message is not None)
self.assertTrue(pull_url is not None)
@@ -455,7 +455,7 @@ class PatchParseTest(PatchTest):
def test_git_pull_with_diff(self):
diff, message = self._find_content(
'0003-git-pull-request-with-diff.mbox')
- pull_url = find_pull_request(message)
+ pull_url = parse_pull_request(message)
self.assertEqual(
'git://git.kernel.org/pub/scm/linux/kernel/git/tip/'
'linux-2.6-tip.git x86-fixes-for-linus',
--
2.7.4
More information about the Patchwork
mailing list