Support ChangeUpdates without providing a CurrentUser

We want to thin out the dependency stack of ChangeRebuilderImpl in our
custom online rebuilding implementation. Using full ChangeControls and
IdentifiedUsers brings in way more than we need to just create author
idents containing the user's full name.

Rework AbstractChangeUpdate to just take an Account.Id and
prepopulated PersonIdent, and teach ChangeRebuilderImpl to use that
path.

Change-Id: I79af43ff21fbd27ad682134d37fae75f043a586a
This commit is contained in:
Dave Borowitz
2016-04-01 16:37:02 -04:00
parent 5a18df0286
commit ebdba50b40
10 changed files with 217 additions and 147 deletions

View File

@@ -207,6 +207,7 @@ public abstract class AbstractChangeNotesTest extends GerritBaseTests {
protected ChangeUpdate newUpdate(Change c, CurrentUser user)
throws Exception {
ChangeUpdate update = TestChanges.newUpdate(injector, c, user);
update.setPatchSetId(c.currentPatchSetId());
update.setAllowWriteToNewRef(true);
return update;
}

View File

@@ -1760,7 +1760,7 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
assertThat(msg.getAuthor()).isNull();
update = newUpdate(c, internalUser);
exception.expect(UnsupportedOperationException.class);
exception.expect(IllegalStateException.class);
update.putApproval("Code-Review", (short) 1);
}