[PATCH] parser: Detect series markers Mercurial produces

Stephen Finucane stephen at that.guru
Mon Jan 23 08:28:58 AEDT 2017


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 at 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)))



More information about the Patchwork mailing list