notify: rework notify to be search based

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
apply: refactor apply command to take a query string

N.B. it's now necessary to say "id:MID" instead of just "MID"

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
scan: include foreign links in JSON

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
fetch: fetch all links and include in the main json file

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
scan: refactor the thread leader code in preparation for rework

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
scan: rework obsolence calculation to handle same subject patches

Pull requests often result the same subject name.  Instead of always looking
for the newest version, maintain a list of dates and versions and look for
a newer version in that list.  IOW, if you have three patches of:

    20130101   [PULL] Block patches
    20130103   [PULL v2] Block patches
    20130110   [PULL] Block patches

Instead of marking both 20130101 and 20130110 obsolete, form a list of:

    [(20130101, 1), (20130103, 2), (20130110, 1)]

Then look for the current message in the list examining the next message to
see if it's obsolete or not.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
query: add user defined labels

The syntax is 'label:NAME'.  The query is stored in the configuration file
in the '[labels]' section with the key being the label name and the value
being the search query.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
notify: switch to a label/template model

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
query: add syntax to query buildbots

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
list: make default list output configurable

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
query: fix parsing of 'not (a or b)'

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
scan: make 'links' section in config optional

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
apply: add --git-dir option

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
apply: add an '-s' option to include a Signed-off-by

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
query: reorder committer check

Sometimes a cover letter has the same subject as a real patch.  That means
it incorrectly has a 'committer' field.  This defeats pull-request committer
detection.

Reorder the checks to fix this for now.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
notify: don't commit to a patch being notified until it goes out

We originally started out very conservative but now that some testing is
under our belts, be a little less conservative about when we indicate that
a notification has happened.

It's annoying to ctrl-c a stuck SMTP session and have patches think it
sent the mail when it really didn't.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
build: give the master commit a name and fix a bug when all steps pass

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
query: allow searching subject tags

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>