use of org.eclipse.egit.core.op.BranchOperation in project egit by eclipse.
the class AbstractDualRepositoryTestCase method assertCommitArrivedAtRemote.
protected void assertCommitArrivedAtRemote(RevCommit branchCommit, Repository remote) throws CoreException {
GitFlowRepository gfRepo = new GitFlowRepository(remote);
BranchOperation checkoutOperation = new BranchOperation(remote, gfRepo.getConfig().getFullFeatureBranchName(MY_FEATURE));
checkoutOperation.execute(null);
RevCommit developHead = findHead(remote);
assertEquals(branchCommit, developHead);
}
use of org.eclipse.egit.core.op.BranchOperation in project egit by eclipse.
the class FeatureCheckoutOperationTest method testFeatureCheckout.
@Test
public void testFeatureCheckout() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureCheckout\n\nfirst commit\n");
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
new BranchOperation(repository, gfRepo.getConfig().getDevelop()).execute(null);
new FeatureCheckoutOperation(gfRepo, MY_FEATURE).execute(null);
assertEquals(gfRepo.getConfig().getFullFeatureBranchName(MY_FEATURE), repository.getFullBranch());
}
use of org.eclipse.egit.core.op.BranchOperation in project egit by eclipse.
the class FeatureFinishOperationTest method testFeatureFinishFail.
@Test(expected = WrongGitFlowStateException.class)
public void testFeatureFinishFail() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureFinishFail\n\nfirst commit\n");
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
new BranchOperation(repository, gfRepo.getConfig().getDevelop()).execute(null);
new FeatureFinishOperation(gfRepo).execute(null);
}
use of org.eclipse.egit.core.op.BranchOperation in project egit by eclipse.
the class HotfixFinishOperationTest method testMergeToDevelopFail.
@Test
public void testMergeToDevelopFail() throws Exception {
testRepository.createInitialCommit("testMergeToDevelopFail\n\nfirst commit\n");
Repository repository = testRepository.getRepository();
new InitOperation(repository).execute(null);
GitFlowRepository gfRepo = new GitFlowRepository(repository);
// setup something we can modify later
File file = testRepository.createFile(project.getProject(), "folder1/file1.txt");
new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
testRepository.appendContentAndCommit(project.getProject(), file, "Hello Release", "Release Commit");
testRepository.appendContentAndCommit(project.getProject(), file, "Hello Merge Commit", "Release Commit 2");
new ReleaseFinishOperation(gfRepo).execute(null);
new HotfixStartOperation(gfRepo, MY_HOTFIX).execute(null);
// modify on first branch
testRepository.appendContentAndCommit(project.getProject(), file, "Hello Hotfix", "Hotfix Commit");
new BranchOperation(repository, gfRepo.getConfig().getDevelop()).execute(null);
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
// modify on second branch
RevCommit developCommit = testRepository.appendContentAndCommit(project.getProject(), file, "Hello Develop", "Develop Commit");
String branchName = gfRepo.getConfig().getHotfixBranchName(MY_HOTFIX);
new BranchOperation(repository, branchName).execute(null);
HotfixFinishOperation hotfixFinishOperation = new HotfixFinishOperation(gfRepo);
hotfixFinishOperation.execute(null);
// TODO: check if the reference implementation cleans up in this case
assertNotNull(gfRepo.findCommitForTag(MY_HOTFIX));
// branch not removed?
assertNotEquals(findBranch(repository, branchName), null);
// not merged on develop => conflict
RevCommit developHead = gfRepo.findHead(DEVELOP);
assertEquals(developCommit, developHead);
assertEquals(MergeResult.MergeStatus.CONFLICTING, hotfixFinishOperation.getMergeResult().getMergeStatus());
// merged on master
RevCommit masterHead = gfRepo.findHead(MY_MASTER);
assertEquals(String.format("Merge branch '%s'", branchName), masterHead.getFullMessage());
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
}
use of org.eclipse.egit.core.op.BranchOperation in project egit by eclipse.
the class ReleaseFinishOperationTest method testReleaseFinishFail.
@Test
public void testReleaseFinishFail() throws Exception {
testRepository.createInitialCommit("testReleaseFinishFail\n\nfirst commit\n");
Repository repository = testRepository.getRepository();
new InitOperation(repository).execute(null);
GitFlowRepository gfRepo = new GitFlowRepository(repository);
new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
new BranchOperation(repository, gfRepo.getConfig().getDevelop()).execute(null);
try {
new ReleaseFinishOperation(gfRepo).execute(null);
fail();
} catch (WrongGitFlowStateException e) {
// success
}
}
Aggregations