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:

committed by
David Pursehouse

parent
e6992e76f6
commit
b074c9f74f
@@ -190,9 +190,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
assertThat(cr.all.get(0).value).is(1);
|
||||
|
||||
PushOneCommit push =
|
||||
pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT,
|
||||
pushFactory.create(db, admin.getIdent(), git, PushOneCommit.SUBJECT,
|
||||
"b.txt", "anotherContent", r.getChangeId());
|
||||
r = push.to(git, "refs/for/master/%l=Code-Review+2");
|
||||
r = push.to("refs/for/master/%l=Code-Review+2");
|
||||
|
||||
ci = get(r.getChangeId());
|
||||
cr = ci.labels.get("Code-Review");
|
||||
@@ -207,9 +207,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
PushOneCommit.Result r = pushTo("refs/for/master");
|
||||
r.assertOkStatus();
|
||||
PushOneCommit push =
|
||||
pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT,
|
||||
pushFactory.create(db, admin.getIdent(), git, PushOneCommit.SUBJECT,
|
||||
"b.txt", "anotherContent", r.getChangeId());
|
||||
r = push.to(git, "refs/changes/" + r.getChange().change().getId().get());
|
||||
r = push.to("refs/changes/" + r.getChange().change().getId().get());
|
||||
r.assertOkStatus();
|
||||
}
|
||||
|
||||
@@ -255,9 +255,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
// specify a single hashtag as option in new patch set
|
||||
String hashtag2 = "tag2";
|
||||
PushOneCommit push =
|
||||
pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT,
|
||||
pushFactory.create(db, admin.getIdent(), git, PushOneCommit.SUBJECT,
|
||||
"b.txt", "anotherContent", r.getChangeId());
|
||||
r = push.to(git, "refs/for/master/%hashtag=" + hashtag2);
|
||||
r = push.to("refs/for/master/%hashtag=" + hashtag2);
|
||||
r.assertOkStatus();
|
||||
expected = ImmutableSet.of(hashtag1, hashtag2);
|
||||
hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
||||
@@ -287,10 +287,9 @@ public abstract class AbstractPushForReview extends AbstractDaemonTest {
|
||||
String hashtag3 = "tag3";
|
||||
String hashtag4 = "tag4";
|
||||
PushOneCommit push =
|
||||
pushFactory.create(db, admin.getIdent(), PushOneCommit.SUBJECT,
|
||||
pushFactory.create(db, admin.getIdent(), git, PushOneCommit.SUBJECT,
|
||||
"b.txt", "anotherContent", r.getChangeId());
|
||||
r = push.to(git,
|
||||
"refs/for/master%hashtag=" + hashtag3 + ",hashtag=" + hashtag4);
|
||||
r = push.to("refs/for/master%hashtag=" + hashtag3 + ",hashtag=" + hashtag4);
|
||||
r.assertOkStatus();
|
||||
expected = ImmutableSet.of(hashtag1, hashtag2, hashtag3, hashtag4);
|
||||
hashtags = gApi.changes().id(r.getChangeId()).getHashtags();
|
||||
|
Reference in New Issue
Block a user