jenkinsci/gerrit-trigger-plugin — pull request #23 by bklarson (2012-05-21 20:44:32+00:00)
Title: Fix behavior of canceling old patch sets

There were several problems with canceling jobs created by old patch sets
when new patch sets are uploaded.

We were removing old jobs when scheduled() was called, but then removed()
was also called, which would cancel the newly-added build we care about.
Instead, we now store the PatchsetCreated event to track the jobs, and
cancel all jobs for a particular Change # when a new patch set is uploaded
but only remove the exact job when remove() is called.

There was also a problem in calling Future.cancel(), as documented in
https://issues.jenkins-ci.org/browse/JENKINS-13829. This was worked around
by storing the parameters used to create each build and canceling jobs with
the same parameters. This is more in-line with how jobs are canceled from
the Web UI.