[PATCH V2] Prefer patch subject/author when they're specified in the body of the email

Guilherme Salgado guilherme.salgado at linaro.org
Fri May 13 21:11:24 EST 2011


On Fri, 2011-05-13 at 10:22 +0200, Peter Maydell wrote:
> On 13 May 2011 09:39, Guilherme Salgado <guilherme.salgado at linaro.org> wrote:
> > To be consistent with git-am, use the subject (extracted from the first line,
> > when it begins with 'Subject:') and the author (extracted from the first or
> > second line, when it begins with 'From:') and use that as Patch.name and
> > Patch.author respectively.  For more details on the exact format that is
> > supported, check git-am's manpage.
> 
> git am lets you put the lines in the order From: then Subject: as well
> as Subject: then From:, which this commit message suggests your patch
> doesn't allow.

Another oversight on my part, thanks for pointing it.

> 
> +def find_author(comment):
> [...]
> +    if first_line.startswith('From:'):
> +        author_line = first_line
> +    elif (first_line.startswith('Subject:') and
> +          second_line.startswith('From:')):
> +        author_line = second_line
> 
> It seems kind of ugly that find_author() has to explicitly know
> about the complete set of header lines that we're happy to extract
> from the body. This just about works for two header lines, but
> I think it would quickly get unwieldy if we get to three or four
> headers which might all be in any order...

That's a good point. I guess I could refactor this into a single method
that extracts all the metadata we want/accept (subject and author for
now) from the email body. It'd still have the knowledge about all set of
header lines we accept, but ISTM that your concern is only with it being
in a function that just extracts one of those lines?

-- 
Guilherme Salgado <https://launchpad.net/~salgado>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/patchwork/attachments/20110513/34bb0050/attachment.pgp>


More information about the Patchwork mailing list