[PATCH 04/10] bin/parsemail: fix wrong parsing of diff comments

Stephen Finucane stephenfinucane at hotmail.com
Sun Sep 25 09:38:43 AEST 2016


On 02 Sep 21:00, 文平波 wrote:
> 
> > 在 2016年8月30日,07:09,Stephen Finucane <stephenfinucane at hotmail.com> 写道:
> > 
> > On 23 Aug 17:03, WEN Pingbo wrote:
> >> If the subject of a submission is prefixed by 'Re:', then it can't be a
> >> patch or cover letter.
> >> 
> >> Signed-off-by: WEN Pingbo <wengpingbo at gmail.com>
> > 
> > Good idea. Some comments below, but I'm mostly happy with this. Thanks
> > :)
> > 
> > Stephen
> > 
> > PS: This is significant enough to submit by itself (outside of the
> > series) IMO
> > 
> >> ---
> >> patchwork/bin/parsemail.py | 31 +++++++++++++++++++------------
> >> 1 file changed, 19 insertions(+), 12 deletions(-)
> >> 
> >> diff --git a/patchwork/bin/parsemail.py b/patchwork/bin/parsemail.py
> >> index 48f809f..6f644da 100755
> >> --- a/patchwork/bin/parsemail.py
> >> +++ b/patchwork/bin/parsemail.py
> >> @@ -341,6 +341,7 @@ def clean_subject(subject, drop_prefixes=None):
> >>           from the subject
> >>     """
> >>     re_re = re.compile(r'^(re|fwd?)[:\s]\s*', re.I)
> >> +    comment_re = re.compile(r'^(re)[:\s]\s*', re.I)
> >>     prefix_re = re.compile(r'^\[([^\]]*)\]\s*(.*)$')
> >>     subject = clean_header(subject)
> >> 
> >> @@ -351,6 +352,7 @@ def clean_subject(subject, drop_prefixes=None):
> >> 
> >>     drop_prefixes.append('patch')
> >> 
> >> +    is_comment = comment_re.match(subject)
> >>     # remove Re:, Fwd:, etc
> >>     subject = re_re.sub(' ', subject)
> >> 
> >> @@ -374,7 +376,7 @@ def clean_subject(subject, drop_prefixes=None):
> >>     if prefixes:
> >>         subject = '[%s] %s' % (','.join(prefixes), subject)
> >> 
> >> -    return (subject, prefixes)
> >> +    return (is_comment, subject, prefixes)
> > 
> > Perhaps this is a bit of a nit, but I don't think a function called
> > 'clean_subject' should be reporting something like 'is_comment'. Could
> > you add a new function and call that instead?
> 
> OK, I will send a separate patch with this comment.
> 
> Pingbo

I can't find V2 of the patch in my inbox, but I merged it after
applying some fixes.

Stephen


More information about the Patchwork mailing list