PushOneCommit: Move Git into constructor

It makes no sense to make multiple method calls on a single
PushOneCommit instance passing in different repositories each time.
Pass a single instance into the factory method instead.

Change-Id: I718aa01c9090bb0394c70626515693c37d3b8125
This commit is contained in:
Dave Borowitz
2015-03-11 16:52:43 -07:00
committed by David Pursehouse
parent e6992e76f6
commit b074c9f74f
20 changed files with 147 additions and 140 deletions

View File

@@ -244,9 +244,9 @@ public class ChangeEditIT extends AbstractDaemonTest {
assertThat(edit.getBasePatchSet().getPatchSetId()).isEqualTo(
current.getPatchSetId());
PushOneCommit push =
pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT, FILE_NAME,
pushFactory.create(db, admin.getIdent(), git, PushOneCommit.SUBJECT, FILE_NAME,
new String(CONTENT_NEW2), changeId2);
push.to(git, "refs/for/master").assertOkStatus();
push.to("refs/for/master").assertOkStatus();
RestResponse r = adminSession.post(urlRebase());
assertThat(r.getStatusCode()).isEqualTo(SC_CONFLICT);
}
@@ -655,23 +655,23 @@ public class ChangeEditIT extends AbstractDaemonTest {
private String newChange(Git git, PersonIdent ident) throws Exception {
PushOneCommit push =
pushFactory.create(db, ident, PushOneCommit.SUBJECT, FILE_NAME,
pushFactory.create(db, ident, git, PushOneCommit.SUBJECT, FILE_NAME,
new String(CONTENT_OLD));
return push.to(git, "refs/for/master").getChangeId();
return push.to("refs/for/master").getChangeId();
}
private String amendChange(Git git, PersonIdent ident, String changeId) throws Exception {
PushOneCommit push =
pushFactory.create(db, ident, PushOneCommit.SUBJECT, FILE_NAME2,
pushFactory.create(db, ident, git, PushOneCommit.SUBJECT, FILE_NAME2,
new String(CONTENT_NEW2), changeId);
return push.to(git, "refs/for/master").getChangeId();
return push.to("refs/for/master").getChangeId();
}
private String newChange2(Git git, PersonIdent ident) throws Exception {
PushOneCommit push =
pushFactory.create(db, ident, PushOneCommit.SUBJECT, FILE_NAME,
pushFactory.create(db, ident, git, PushOneCommit.SUBJECT, FILE_NAME,
new String(CONTENT_OLD));
return push.rm(git, "refs/for/master").getChangeId();
return push.rm("refs/for/master").getChangeId();
}
private Change getChange(String changeId) throws Exception {