use of org.eclipse.egit.gitflow.op.InitOperation in project egit by eclipse.
the class InitHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell activeShell = HandlerUtil.getActiveShell(event);
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
if (gfRepo == null) {
return null;
}
Repository repository = gfRepo.getRepository();
if (!gfRepo.hasBranches()) {
boolean createMaster = openQuestion(activeShell, UIText.InitHandler_emptyRepository, UIText.InitHandler_doYouWantToInitNow);
if (!createMaster) {
return null;
}
createInitialCommit(repository);
}
InitDialog dialog = new InitDialog(activeShell, gfRepo, getBranches(repository));
if (dialog.open() != Window.OK) {
return null;
}
InitOperation initOperation = new InitOperation(repository, dialog.getResult());
JobUtil.scheduleUserWorkspaceJob(initOperation, UIText.InitHandler_initializing, JobFamilies.GITFLOW_FAMILY);
return null;
}
use of org.eclipse.egit.gitflow.op.InitOperation in project egit by eclipse.
the class BranchNameValidatorTest method testFeatureExists.
@Test
public void testFeatureExists() throws Exception {
testRepository.createInitialCommit("testInitOperation\n\nfirst commit\n");
Repository repository = testRepository.getRepository();
new InitOperation(repository).execute(null);
GitFlowRepository gfRepo = new GitFlowRepository(repository);
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
assertTrue(featureExists(gfRepo, MY_FEATURE));
}
use of org.eclipse.egit.gitflow.op.InitOperation in project egit by eclipse.
the class GitFlowRepositoryConfigTest method testIsInitialized.
@Test
public void testIsInitialized() throws Exception {
repository1.createInitialCommit("testIsInitialized\n\nfirst commit\n");
Repository repository = repository2.getRepository();
GitFlowConfig gitFlowConfig = new GitFlowConfig(repository);
assertFalse(gitFlowConfig.isInitialized());
new InitOperation(repository).execute(null);
assertTrue(gitFlowConfig.isInitialized());
}
use of org.eclipse.egit.gitflow.op.InitOperation in project egit by eclipse.
the class GitFlowRepositoryTest method testGetFeatureBranchName.
@Test
public void testGetFeatureBranchName() throws Exception {
repository1.createInitialCommit("testGetFeatureBranchName\n\nfirst commit\n");
Repository repository = repository1.getRepository();
GitFlowRepository gfRepo = new GitFlowRepository(repository);
InitParameters initParameters = new InitParameters();
initParameters.setDevelop(DEVELOP);
initParameters.setMaster(GitFlowDefaults.MASTER);
initParameters.setFeature(FEATURE_PREFIX);
initParameters.setRelease(RELEASE_PREFIX);
initParameters.setHotfix(HOTFIX_PREFIX);
initParameters.setVersionTag(VERSION_TAG);
new InitOperation(repository, initParameters).execute(null);
assertTrue(gfRepo.getFeatureBranches().isEmpty());
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
Ref actualFeatureRef = repository.exactRef(R_HEADS + gfRepo.getConfig().getFeaturePrefix() + MY_FEATURE);
assertEquals(MY_FEATURE, gfRepo.getFeatureBranchName(actualFeatureRef));
}
use of org.eclipse.egit.gitflow.op.InitOperation in project egit by eclipse.
the class GitFlowRepositoryTest method testGetFeatureBranches.
@Test
public void testGetFeatureBranches() throws Exception {
repository1.createInitialCommit("testGetFeatureBranches\n\nfirst commit\n");
Repository repository = repository1.getRepository();
GitFlowRepository gfRepo = new GitFlowRepository(repository);
new InitOperation(repository).execute(null);
assertTrue(gfRepo.getFeatureBranches().isEmpty());
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
assertEquals(R_HEADS + gfRepo.getConfig().getFeaturePrefix() + MY_FEATURE, gfRepo.getFeatureBranches().get(0).getName());
}
Aggregations