Store subject and original subject in notedb

This adds a 'Subject' footer to the commit message of the
refs/changes/XX/YYYY/meta notes branch when the change is created and
whenever a new patch set with a different subject is added.

The current subject is taken from most recent commit on the notes
branch that contains a 'Subject' footer. The original subject is taken
from the first commit on the notes branch.

Tests which manually insert new changes must be adapted so that the
initial commit to the notes branch contains the subject.

In order to set the 'Subject' footer only when the subject was
changed, we must compare the new subject to the old subject when a new
patch set is inserted. To be able to access the old subject when a
a new patch set is created, PatchSetInserter must ensure that the body
of the commit was parsed. Otherwise the subject would not be available
and trying to get it would fail with a NullPointerException.

Change-Id: I71bfe88e16c3e0b41530f399441b16e2cd44f59e
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-01-21 14:51:10 +01:00
parent e8618b8e55
commit 12fbf41e95
16 changed files with 144 additions and 52 deletions

View File

@@ -2241,7 +2241,7 @@ public class ReceiveCommits {
Map<String, Short> approvals = new HashMap<>();
ChangeUpdate update = updateFactory.create(changeCtl, createdOn);
update.setSubject("Create patch set " + psId.get());
update.setSubjectForCommit("Create patch set " + psId.get());
update.setPatchSetId(psId);
if (magicBranch != null) {