use of org.eclipse.egit.core.op.BranchOperation in project egit by eclipse.
the class InitOperation method execute.
@Override
public void execute(IProgressMonitor monitor) throws CoreException {
try {
setPrefixes(feature, release, hotfix, versionTag);
setBranches(develop, master);
repository.getRepository().getConfig().save();
} catch (IOException e) {
throw new CoreException(error(e.getMessage(), e));
}
SubMonitor progress = SubMonitor.convert(monitor, 3);
if (!repository.hasBranches()) {
new CommitOperation(repository.getRepository(), repository.getConfig().getUser(), repository.getConfig().getUser(), CoreText.InitOperation_initialCommit).execute(progress.newChild(1));
}
try {
if (!isMasterBranchAvailable()) {
throw new CoreException(error(NLS.bind(CoreText.InitOperation_localMasterDoesNotExist, master)));
}
RevCommit head = repository.findHead();
if (!repository.hasBranch(develop)) {
CreateLocalBranchOperation branchFromHead = createBranchFromHead(develop, head);
branchFromHead.execute(progress.newChild(1));
BranchOperation checkoutOperation = new BranchOperation(repository.getRepository(), develop);
checkoutOperation.execute(progress.newChild(1));
}
} catch (WrongGitFlowStateException e) {
throw new CoreException(error(e));
} catch (GitAPIException e) {
throw new CoreException(error(e.getMessage(), e));
}
}
use of org.eclipse.egit.core.op.BranchOperation 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.core.op.BranchOperation 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.core.op.BranchOperation in project egit by eclipse.
the class FeatureCheckoutOperation method execute.
@Override
public void execute(IProgressMonitor monitor) throws CoreException {
String branchName = repository.getConfig().getFeatureBranchName(featureName);
boolean dontCloseProjects = false;
BranchOperation branchOperation = new BranchOperation(repository.getRepository(), branchName, dontCloseProjects);
branchOperation.execute(monitor);
result = branchOperation.getResult();
}
Aggregations