use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class InitOperationTest method testInit.
@Test
public void testInit() throws Exception {
testRepository.createInitialCommit("testInitOperation\n\nfirst commit\n");
Repository repository = testRepository.getRepository();
InitOperation initOperation = new InitOperation(repository);
initOperation.execute(null);
GitFlowRepository gfRepo = new GitFlowRepository(repository);
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
assertPrefixEquals(FEATURE_PREFIX, FEATURE_KEY, repository);
assertPrefixEquals(RELEASE_PREFIX, RELEASE_KEY, repository);
assertPrefixEquals(HOTFIX_PREFIX, HOTFIX_KEY, repository);
// TODO this below is unstable and I have no idea why.
// Sometimes it receives null instead of the empty string
// assertPrefixEquals(VERSION_TAG, VERSION_TAG_KEY, repository);
assertBranchEquals(DEVELOP, DEVELOP_KEY, repository);
assertBranchEquals(MASTER, MASTER_KEY, repository);
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class HotfixStartHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
InputDialog inputDialog = new InputDialog(HandlerUtil.getActiveShell(event), UIText.HotfixStartHandler_provideHotfixName, UIText.HotfixStartHandler_pleaseProvideANameForTheNewHotfix, // $NON-NLS-1$
"", new HotfixNameValidator(gfRepo));
if (inputDialog.open() != Window.OK) {
return null;
}
final String hotfixName = inputDialog.getValue();
HotfixStartOperation hotfixStartOperation = new HotfixStartOperation(gfRepo, hotfixName);
JobUtil.scheduleUserWorkspaceJob(hotfixStartOperation, UIText.HotfixStartHandler_startingNewHotfix, JobFamilies.GITFLOW_FAMILY);
return null;
}
use of org.eclipse.egit.gitflow.GitFlowRepository 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.GitFlowRepository in project egit by eclipse.
the class ReleaseFinishHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
if (gfRepo == null) {
return error(UIText.Handlers_noGitflowRepositoryFound);
}
final ReleaseFinishOperation releaseFinishOperation;
try {
releaseFinishOperation = new ReleaseFinishOperation(gfRepo);
String releaseBranch = gfRepo.getRepository().getBranch();
String develop = gfRepo.getConfig().getDevelop();
JobUtil.scheduleUserWorkspaceJob(releaseFinishOperation, UIText.ReleaseFinishHandler_finishingRelease, JobFamilies.GITFLOW_FAMILY);
IJobManager jobMan = Job.getJobManager();
jobMan.join(JobFamilies.GITFLOW_FAMILY, null);
MergeResult mergeResult = releaseFinishOperation.getMergeResult();
MergeStatus mergeStatus = mergeResult.getMergeStatus();
if (!MergeStatus.CONFLICTING.equals(mergeStatus)) {
return null;
}
if (handleConflictsOnMaster(gfRepo)) {
return null;
}
MultiStatus status = createMergeConflictInfo(develop, releaseBranch, mergeResult);
ErrorDialog.openError(null, UIText.ReleaseFinishHandler_Conflicts, null, status);
} catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException | InterruptedException e) {
return error(e.getMessage(), e);
}
return null;
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class ReleaseStartHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
final String startCommitSha1 = getStartCommit(event);
Shell activeShell = HandlerUtil.getActiveShell(event);
doExecute(gfRepo, startCommitSha1, activeShell);
return null;
}
Aggregations