query: bring back status:unapplied

Commit 8feb88401a27e1238b5b81265bff36a4e4a19138 ("list: make default
list output configurable") accidentally dropped status:unapplied.

Bring back status:unapplied, which is still documented in README.md.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
patches: drop unused strlist() helper function

Commit 95bdd92c951d985564e599d4d1fd15fa9ddb0a43 ("notify: rework notify
to be search based") dropped the only strlist() caller.

Remove the strlist() function since it is no longer used.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scan: skip invalid git refspecs in pull request emails

Pull request emails may contain git URIs to external repositories such
as library dependencies.  If a git refspec doesn't parse, simply skip it
and continue scanning the email.

This patch prevents a ValueError exception when split() fails on a git
URI.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scan: only accept tags in the first column

There is an unnecessary line = line.strip() which causes Reviewed-by:
and Acked-by: tags to be accepted from quoted email messages or commits.
This leads to spurious tags.

Since parse_tag() already strips the value, there is no need to strip
the line.  Valid tags must begin in the first column.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
series: rename any_applied() to any_committed()

The any_applied() function checks whether any patch in a series has been
committed.  Rename the function to make this clear.

The term "applied" will be used for patches that have received a
"Thanks, applied" message from a maintainer in the future, so don't
overload the meaning.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scan: add 'applied-by' metadata to series

Store the name/email of the person who sent a "Thanks, applied" reply.
This is useful for detecting patch series that have already been merged
by subsystem maintainers but are not yet committed in the main
repository.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
query: add status:applied

Now that patch series have 'applied-by' metadata we can query them.
Also update the status:unapplied query expression to exclude patches
that have "Thanks, applied" replies.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
message: encode/decode Unicode payload

The Python email modules do not automatically encode/decode payloads,
the charset must be applied manually.  Note that emails also have a
content transfer encoding like base64, which is different from the
charset.

This patch decodes email payloads to Unicode and then encodes them again
to generate mbox files.  This solves several problems including
non-ASCII tag values being inconsistent compared depending on their
email encoding (e.g. UTF-8 and Latin-1 strings will not be equal even
though they show the same Unicode characters).

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
list: fix outdated variable name

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
scan: fix missing tags in single patches

When a single patch without a cover letter is sent, the patches.json
metadata contains the correct tags but the mbox file is missing them.

This patch fixes the problem by adding the top patch to message_list
after we've processed the reply emails which could contain Reviewed-by
tags.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
mbox: generate mbox files in UTF-8 encoding

This patch fixes a UnicodeEncodeError when a reviewer with a non-ASCII
name replies to an ASCII patch email.  We must encode the patch in UTF-8
so that the Reviewed-by tag can be added.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>