Add $change.originalSubject for email templates

GMail threads messages together by subject and ignores the list
headers included by Gerrit.  Keep track of the first (or most recent)
subject used by each change so that the string is available to the
site's ChangeSubject.vm template.

Site administrators that run servers whose end-user base is mostly on
GMail (e.g. internal Google) can modify the site's ChangeSubject.vm
to use $change.originalSubject to improve threading for GMail inboxes.

To simplify the schema upgrade for gerrit-review the originalSubject
field is automatically taken from the existing subject field during
first use.  This avoids needing to rewrite every change record in the
database to copy over the subject string to originalSubject.  Avoiding
update of every change also improves migration times for any large
server, as the database will not update XX,XXX merged changes.

Change-Id: Idc36cbf0cef9fe06b0b272f6a7eefe76635e3e19
4 files changed