use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureFinishOperationTest method testFeatureFinishFastForward.
@Test
public void testFeatureFinishFastForward() throws Exception {
String fileName = "theFirstFile.txt";
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureFinish\n\nfirst commit\n");
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
RevCommit branchCommit = addFileAndCommit(fileName, "adding file on feature branch");
new FeatureFinishOperation(gfRepo).execute(null);
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
String branchName = gfRepo.getConfig().getFeatureBranchName(MY_FEATURE);
assertNull(findBranch(repository, branchName));
RevCommit developHead = gfRepo.findHead();
assertEquals(branchCommit, developHead);
assertEquals(2, countCommits(repository));
assertTrue(new File(repository.getDirectory() + "/../" + fileName).exists());
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureListOperationTest method testFeatureList.
@Test
public void testFeatureList() throws Exception {
GitFlowRepository gfRepo1 = new GitFlowRepository(repository1.getRepository());
GitFlowRepository gfRepo2 = new GitFlowRepository(repository2.getRepository());
new FeatureStartOperation(gfRepo1, MY_FEATURE).execute(null);
FeatureListOperation featureListOperation = new FeatureListOperation(gfRepo2, 0);
featureListOperation.execute(null);
String name = gfRepo2.getConfig().getFullFeatureBranchName(MY_FEATURE);
assertNotNull(featureListOperation.getOperationResult().getAdvertisedRef(name));
List<Ref> result = featureListOperation.getResult();
assertEquals(1, result.size());
assertEquals(R_REMOTES + DEFAULT_REMOTE_NAME + SEP + gfRepo2.getConfig().getFeatureBranchName(MY_FEATURE), result.get(0).getName());
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureRebaseOperationTest method testFeatureRebase.
@Test
public void testFeatureRebase() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureRebase\n\nfirst commit\n");
RevCommit initialCommit = gfRepo.findHead();
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
String branchCommitMessage = "adding first file on feature branch";
addFileAndCommit("theFile.txt", branchCommitMessage);
testRepository.checkoutBranch(gfRepo.getConfig().getDevelop());
RevCommit developCommit = addFileAndCommit("theOtherFile.txt", "adding second file on develop branch");
new FeatureCheckoutOperation(gfRepo, MY_FEATURE).execute(null);
assertEquals(initialCommit, gfRepo.findHead().getParent(0));
FeatureRebaseOperation featureRebaseOperation = new FeatureRebaseOperation(gfRepo);
featureRebaseOperation.execute(null);
RebaseResult res = featureRebaseOperation.getOperationResult();
assertEquals(RebaseResult.Status.OK, res.getStatus());
assertEquals(branchCommitMessage, gfRepo.findHead().getShortMessage());
assertEquals(developCommit, parseCommit(repository, repository.resolve("HEAD^")));
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureStartOperationTest method testFeatureStartOnMaster.
public void testFeatureStartOnMaster() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureStartOnMaster\n\nfirst commit\n");
BranchOperation branchOperation = new BranchOperation(repository, MY_MASTER);
branchOperation.execute(null);
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class HotfixFinishOperationTest method testHotfixFinishSingleCommit.
@Test
public void testHotfixFinishSingleCommit() throws Exception {
testRepository.createInitialCommit("testHotfixFinish\n\nfirst commit\n");
Repository repository = testRepository.getRepository();
new InitOperation(repository).execute(null);
GitFlowRepository gfRepo = new GitFlowRepository(repository);
new HotfixStartOperation(gfRepo, MY_HOTFIX).execute(null);
RevCommit branchCommit = testRepository.createInitialCommit("testHotfixFinish\n\nbranch commit\n");
new HotfixFinishOperation(gfRepo).execute(null);
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
String branchName = gfRepo.getConfig().getHotfixBranchName(MY_HOTFIX);
// tag created?
RevCommit taggedCommit = gfRepo.findCommitForTag(MY_HOTFIX);
assertEquals(formatMergeCommitMessage(branchName), taggedCommit.getShortMessage());
// branch removed?
assertEquals(findBranch(repository, branchName), null);
RevCommit developHead = gfRepo.findHead(DEVELOP);
assertNotEquals(branchCommit, developHead);
RevCommit masterHead = gfRepo.findHead(MY_MASTER);
assertEquals(formatMergeCommitMessage(branchName), masterHead.getShortMessage());
}
Aggregations