use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class ReleaseStartOperationTest method testReleaseBranchCreatedFromCommit.
@Test
public void testReleaseBranchCreatedFromCommit() throws Exception {
RevCommit initialCommit = testRepository.createInitialCommit("testReleaseBranchCreatedFromCommit\n\nfirst commit\n");
testRepository.createInitialCommit("testReleaseBranchCreatedFromCommit\n\nsecond commit\n");
Repository repository = testRepository.getRepository();
new InitOperation(repository).execute(null);
GitFlowRepository gfRepo = new GitFlowRepository(repository);
ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation(gfRepo, initialCommit.getName(), MY_RELEASE);
releaseStartOperation.execute(null);
assertNotNull(releaseStartOperation.getSchedulingRule());
assertEquals(gfRepo.getConfig().getFullReleaseBranchName(MY_RELEASE), repository.getFullBranch());
assertEquals(initialCommit, gfRepo.findHead());
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class AbstractPublishHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
try {
int timeout = Activator.getDefault().getPreferenceStore().getInt(UIPreferences.REMOTE_CONNECTION_TIMEOUT);
CurrentBranchPublishOperation featurePublishOperation = new CurrentBranchPublishOperation(gfRepo, timeout);
JobUtil.scheduleUserWorkspaceJob(featurePublishOperation, getProgressText(), JobFamilies.REBASE);
} catch (CoreException e) {
return error(e.getMessage(), e);
}
return null;
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureCheckoutOperationTest method testFeatureCheckoutConflicts.
@Test
public void testFeatureCheckoutConflicts() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureCheckoutConflicts\n\nfirst commit\n");
// setup something we can modify later
IFile file = testUtils.addFileToProject(project.getProject(), "folder1/file1.txt", "Hello world");
testRepository.connect(project.getProject());
testRepository.trackAllFiles(project.getProject());
testRepository.commit("Initial commit");
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
// modify on first branch
testUtils.changeContentOfFile(project.getProject(), file, "Hello Feature");
testRepository.addToIndex(file);
testRepository.commit("Feature commit");
new BranchOperation(repository, gfRepo.getConfig().getDevelop()).execute(null);
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
// modify on second branch
testUtils.changeContentOfFile(project.getProject(), file, "Hello Develop");
testRepository.addToIndex(file);
FeatureCheckoutOperation featureCheckoutOperation = new FeatureCheckoutOperation(gfRepo, MY_FEATURE);
featureCheckoutOperation.execute(null);
assertEquals(Status.CONFLICTS, featureCheckoutOperation.getResult().getStatus());
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureFinishOperationTest method testFeatureFinishKeepBranch.
@Test
public void testFeatureFinishKeepBranch() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureFinishKeepBranch\n\nfirst commit\n");
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
addFileAndCommit("foo.txt", "testFeatureFinishKeepBranch\n\nbranch commit 1\n");
addFileAndCommit("bar.txt", "testFeatureFinishKeepBranch\n\nbranch commit 2\n");
FeatureFinishOperation featureFinishOperation = new FeatureFinishOperation(gfRepo);
featureFinishOperation.setKeepBranch(true);
featureFinishOperation.execute(null);
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
String branchName = gfRepo.getConfig().getFeatureBranchName(MY_FEATURE);
assertNotNull(findBranch(repository, branchName));
assertEquals(formatMergeCommitMessage(branchName) + " into develop", gfRepo.findHead().getFullMessage());
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureFinishOperationTest method testFeatureFinishSquash.
@Test
public void testFeatureFinishSquash() throws Exception {
String fileName = "theFirstFile.txt";
String fileName2 = "theSecondFile.txt";
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureFinishSquash\n\nfirst commit\n");
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
String branchName = gfRepo.getConfig().getFeatureBranchName(MY_FEATURE);
addFileAndCommit(fileName, "adding first file on feature branch");
addFileAndCommit(fileName2, "adding second file on feature branch");
FeatureFinishOperation featureFinishOperation = new FeatureFinishOperation(gfRepo);
featureFinishOperation.setSquash(true);
featureFinishOperation.execute(null);
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
assertEquals(null, findBranch(repository, branchName));
assertEquals(1, countCommits(repository));
assertTrue(new File(repository.getDirectory() + "/../" + fileName).exists());
assertTrue(new File(repository.getDirectory() + "/../" + fileName2).exists());
Status status = Git.wrap(repository).status().call();
assertTrue(status.hasUncommittedChanges());
}
Aggregations