Historically, voting in Gerrit has always happened before a change is
submitted, and is an integral piece of the submit rule based workflow
for submitting changes. However, there are some circumstances where
reviewing a change after it has been merged is advantageous:
* when a change is merged into the branch by a direct push
* when a commit is merged bypassing Gerrit entirely, and a new change
is created after the fact using the %merged push option (after
I4de55806).
When this happens, it can be useful to not only write comments but
also vote on the merged changes.
Support this in Gerrit, and add a postSubmit bit to PatchSetApproval.
In NoteDb, this bit is populated automatically, based on whether an
approval happened after the change status was set to merged.
One major caveat is that PostReview enforces that votes can only be
increased, not decreased, for post-submit approvals. This limitation
exists for several reasons.
First, for normal changes that underwent pre-submit code review, we
assume that high review scores were necessary for submission. Allowing
scores to be reduced after the fact could make a change look like it
never should have been submitted in the first place. It should usually
be possible to figure out what happened by reading the message log
closely, but it's less confusing if we try to avoid this situation
entirely.
Second, since a submitted change is already a part of history, no
amount of negative voting on that change will cause the change to stop
being a part of history. (It could be removed via force push, but
that's outside of the code review.) Disallowing scores from being
reduced helps avoid the false impression that a negative score might
actually have some effect.
Finally, we want to enable developers to write tools that audit the
full commit history of a project and ensure that all commits have been
properly approved. These tools can make a major optimization by
assuming that once a change has been approved (e.g. has received
Code-Review+2), it can't be un-approved.
Change-Id: Ie337b5fa5261c873f3038e37300e8e626f9d6d3e