LabelNormalizer: record what happens to each approval

Unchanged, updated, and deleted approvals may need to be handled
separately by the underlying storage layer, e.g. in Submit. Record
this information in the result of LabelNormalizer.normalize().

For callers that don't care whether approvals were updated or not,
provide a convenience method to concatenate them.

Change-Id: Ifea7db3f7333d3ddb5e4d647a1d7e8eeb8cbff11
This commit is contained in:
Dave Borowitz
2014-02-03 18:15:54 -08:00
parent 1f046eab79
commit e0dc089fb8
7 changed files with 123 additions and 30 deletions

View File

@@ -81,8 +81,8 @@ public class ApprovalCopier {
db.patchSetApprovals().insert(getForPatchSet(db, ctl, ps));
}
private List<PatchSetApproval> getForPatchSet(ReviewDb db, ChangeControl ctl,
PatchSet ps) throws OrmException {
private Iterable<PatchSetApproval> getForPatchSet(ReviewDb db,
ChangeControl ctl, PatchSet ps) throws OrmException {
ChangeData cd = changeDataFactory.create(db, ctl);
try {
ProjectState project =
@@ -123,7 +123,7 @@ public class ApprovalCopier {
}
}
}
return labelNormalizer.normalize(ctl, byUser.values());
return labelNormalizer.normalize(ctl, byUser.values()).getNormalized();
} finally {
repo.close();
}