Notedb: Fix change message on submit of whole topic

When notedb was enabled the change message about the submit did not
include the submitter when a whole topic was submitted together. This
was because the SUBMIT label which was applied to the change to record
the submitter was not visible from the change notes yet, because they
were not reloaded yet. We already reload the changes notes later to
get the update about the submitter, just do this reload a bit earlier.

This fixes the tests for submitting a whole topic when notedb is
enabled.

Change-Id: I5e33aa1bd5b9c9cb8502f0cdde9b2f0250d39090
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2015-11-10 13:59:57 -08:00
parent b2fd4771f4
commit c9fde1981b

View File

@@ -860,6 +860,9 @@ public class MergeOp {
// If mergeTip is null merge failed and mergeResultRev will not be read.
ObjectId mergeResultRev =
mergeTip != null ? mergeTip.getMergeResults().get(commit) : null;
// The change notes must be forcefully reloaded so that the SUBMIT
// approval that we added earlier is visible
commit.notes().reload();
try {
ChangeMessage msg;
switch (s) {
@@ -981,9 +984,7 @@ public class MergeOp {
PatchSet.Id mergedId = commit.change().currentPatchSetId();
merged = db.patchSets().get(mergedId);
c = setMergedPatchSet(c.getId(), mergedId);
// The change notes must be forcefully reloaded so that the SUBMIT
// approval that we added earlier is visible
submitter = approvalsUtil.getSubmitter(db, commit.notes().reload(), mergedId);
submitter = approvalsUtil.getSubmitter(db, commit.notes(), mergedId);
ChangeControl control = commit.getControl();
update = updateFactory.create(control, c.getLastUpdatedOn());