diff mbox

parser: Detect series markers Mercurial produces

Message ID 20170122004454.7988-1-andrew.shadura@collabora.co.uk
State Superseded
Headers show

Commit Message

Andrej Shadura Jan. 22, 2017, 12:44 a.m. UTC
Unlike Git, Mercurial produces email subject lines of the
following format: "[PATCH M of N] ...". '(?:/| of )' pattern
matches both 'M/N' and 'M of N' formats.

Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>
---
 patchwork/parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Finucane Jan. 22, 2017, 9:28 p.m. UTC | #1
On Sun, 2017-01-22 at 01:44 +0100, Andrew Shadura wrote:
> Unlike Git, Mercurial produces email subject lines of the
> following format: "[PATCH M of N] ...". '(?:/| of )' pattern
> matches both 'M/N' and 'M of N' formats.
> 
> Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk>

This looks a-OK to me, but I would like to add an additional test case
in patchwork/tests/test_series.py to prevent this regressing if we
could. I can write the tests but I need some mbox files to validate
against. Could you supply me with some sample, Mercurial-produced patch
emails for this (email me directly)? A two patch series, with and
without a cover letter, would suffice (look at the files in
patchwork/tests/series for examples).

Thanks,
Stephen

> ---
>  patchwork/parser.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/patchwork/parser.py b/patchwork/parser.py
> index 16cc53c..2e692fa 100644
> --- a/patchwork/parser.py
> +++ b/patchwork/parser.py
> @@ -309,7 +309,7 @@ def parse_series_marker(subject_prefixes):
>          (x, n) if markers found, else (None, None)
>      """
>  
> -    regex = re.compile('^([0-9]+)/([0-9]+)$')
> +    regex = re.compile('^([0-9]+)(?:/| of )([0-9]+)$')
>      m = _find_matching_prefix(subject_prefixes, regex)
>      if m:
>          return (int(m.group(1)), int(m.group(2)))
diff mbox

Patch

diff --git a/patchwork/parser.py b/patchwork/parser.py
index 16cc53c..2e692fa 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -309,7 +309,7 @@  def parse_series_marker(subject_prefixes):
         (x, n) if markers found, else (None, None)
     """
 
-    regex = re.compile('^([0-9]+)/([0-9]+)$')
+    regex = re.compile('^([0-9]+)(?:/| of )([0-9]+)$')
     m = _find_matching_prefix(subject_prefixes, regex)
     if m:
         return (int(m.group(1)), int(m.group(2)))