use of com.google.gerrit.extensions.api.projects.BranchInput in project gerrit by GerritCodeReview.
the class SubmitByMergeIfNecessaryIT method submitWithMergedAncestorsOnOtherBranch.
@Test
public void submitWithMergedAncestorsOnOtherBranch() throws Exception {
RevCommit initialHead = getRemoteHead();
PushOneCommit.Result change1 = createChange(testRepo, "master", "base commit", "a.txt", "1", "");
submit(change1.getChangeId());
RevCommit headAfterFirstSubmit = getRemoteHead();
gApi.projects().name(project.get()).branch("branch").create(new BranchInput());
PushOneCommit.Result change2 = createChange(testRepo, "master", "We want to commit this to master first", "a.txt", "2", "");
submit(change2.getChangeId());
RevCommit headAfterSecondSubmit = getRemoteLog(project, "master").get(0);
assertThat(headAfterSecondSubmit.getShortMessage()).isEqualTo(change2.getCommit().getShortMessage());
RevCommit tip2 = getRemoteLog(project, "branch").get(0);
assertThat(tip2.getShortMessage()).isEqualTo(change1.getCommit().getShortMessage());
PushOneCommit.Result change3 = createChange(testRepo, "branch", "This commit is based on master, which includes change2, " + "but is targeted at branch, which doesn't include it.", "a.txt", "3", "");
submit(change3.getChangeId());
List<RevCommit> log3 = getRemoteLog(project, "branch");
assertThat(log3.get(0).getShortMessage()).isEqualTo(change3.getCommit().getShortMessage());
assertThat(log3.get(1).getShortMessage()).isEqualTo(change2.getCommit().getShortMessage());
assertRefUpdatedEvents(initialHead, headAfterFirstSubmit, headAfterFirstSubmit, headAfterSecondSubmit);
assertChangeMergedEvents(change1.getChangeId(), headAfterFirstSubmit.name(), change2.getChangeId(), headAfterSecondSubmit.name());
}
use of com.google.gerrit.extensions.api.projects.BranchInput in project gerrit by GerritCodeReview.
the class CheckMergeabilityIT method setUp.
@Before
public void setUp() throws Exception {
branch = new Branch.NameKey(project, "test");
gApi.projects().name(branch.getParentKey().get()).branch(branch.get()).create(new BranchInput());
}
use of com.google.gerrit.extensions.api.projects.BranchInput in project gerrit by GerritCodeReview.
the class CreateBranchIT method assertCreateFails.
private void assertCreateFails(Class<? extends RestApiException> errType) throws Exception {
exception.expect(errType);
branch().create(new BranchInput());
}
use of com.google.gerrit.extensions.api.projects.BranchInput in project gerrit by GerritCodeReview.
the class DeleteBranchIT method setUp.
@Before
public void setUp() throws Exception {
project = createProject(name("p"));
branch = new Branch.NameKey(project, "test");
branch().create(new BranchInput());
}
use of com.google.gerrit.extensions.api.projects.BranchInput in project gerrit by GerritCodeReview.
the class CreateBranchCommand method run.
@Override
protected void run() throws UnloggedFailure {
try {
BranchInput in = new BranchInput();
in.revision = revision;
gApi.projects().name(project.getProject().getNameKey().get()).branch(name).create(in);
} catch (RestApiException e) {
throw die(e);
}
}
Aggregations