use of org.eclipse.egit.gitflow.GitFlowRepository 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.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureStartOperationTest method testFeatureStart.
@Test
public void testFeatureStart() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureStart\n\nfirst commit\n");
FeatureStartOperation featureStartOperation = new FeatureStartOperation(gfRepo, MY_FEATURE);
assertNull(featureStartOperation.getSchedulingRule());
featureStartOperation.execute(null);
assertEquals(gfRepo.getConfig().getFullFeatureBranchName(MY_FEATURE), repository.getFullBranch());
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureTrackOperationTest method testFeatureTrack.
@Test
public void testFeatureTrack() throws Exception {
GitFlowRepository gfRepo1 = new GitFlowRepository(repository1.getRepository());
GitFlowRepository gfRepo2 = new GitFlowRepository(repository2.getRepository());
new FeatureStartOperation(gfRepo1, MY_FEATURE).execute(null);
RevCommit branchCommit = repository1.createInitialCommit("testFeatureTrack");
FeatureTrackOperation featureTrackOperation = new FeatureTrackOperation(gfRepo2, getFirstRemoteFeatureRef(gfRepo2), NO_TIMEOUT);
featureTrackOperation.execute(null);
FetchResult operationResult = featureTrackOperation.getOperationResult();
assertNotNull(operationResult.getAdvertisedRef(gfRepo2.getConfig().getFullFeatureBranchName(MY_FEATURE)));
assertEquals(gfRepo2.getConfig().getFeatureBranchName(MY_FEATURE), repository2.getRepository().getBranch());
assertEquals(branchCommit, findHead(repository2.getRepository()));
RevCommit localCommit = repository2.createInitialCommit("testFeatureTrack2");
new CurrentBranchPublishOperation(gfRepo2, 0).execute(null);
assertEquals(localCommit, findHead(repository2.getRepository()));
// config updated?
assertEquals(DEFAULT_REMOTE_NAME, getRemoteName(gfRepo2, MY_FEATURE));
assertEquals(R_HEADS + gfRepo2.getConfig().getFeatureBranchName(MY_FEATURE), gfRepo2.getUpstreamBranchName(MY_FEATURE));
}
use of org.eclipse.egit.gitflow.GitFlowRepository 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.gitflow.GitFlowRepository in project egit by eclipse.
the class HotfixStartOperationTest method testHotfixStart.
@Test
public void testHotfixStart() throws Exception {
testRepository.createInitialCommit("testHotfixStart\n\nfirst commit\n");
Repository repository = testRepository.getRepository();
new InitOperation(repository).execute(null);
GitFlowRepository gfRepo = new GitFlowRepository(repository);
HotfixStartOperation hotfixStartOperation = new HotfixStartOperation(gfRepo, MY_HOTFIX);
assertNull(hotfixStartOperation.getSchedulingRule());
hotfixStartOperation.execute(null);
assertEquals(gfRepo.getConfig().getFullHotfixBranchName(MY_HOTFIX), repository.getFullBranch());
}
Aggregations