Search in sources :

Example 1 with HotfixFinishOperation

use of org.eclipse.egit.gitflow.op.HotfixFinishOperation in project egit by eclipse.

the class HotfixFinishHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
    if (gfRepo == null) {
        return error(UIText.Handlers_noGitflowRepositoryFound);
    }
    HotfixFinishOperation hotfixFinishOperation;
    try {
        hotfixFinishOperation = new HotfixFinishOperation(gfRepo);
        String hotfixBranch = gfRepo.getRepository().getBranch();
        String develop = gfRepo.getConfig().getDevelop();
        JobUtil.scheduleUserWorkspaceJob(hotfixFinishOperation, UIText.HotfixFinishHandler_finishingHotfix, JobFamilies.GITFLOW_FAMILY);
        IJobManager jobMan = Job.getJobManager();
        jobMan.join(JobFamilies.GITFLOW_FAMILY, null);
        MergeResult mergeResult = hotfixFinishOperation.getMergeResult();
        MergeStatus mergeStatus = mergeResult.getMergeStatus();
        if (!MergeStatus.CONFLICTING.equals(mergeStatus)) {
            return null;
        }
        if (handleConflictsOnMaster(gfRepo)) {
            return null;
        }
        MultiStatus status = createMergeConflictInfo(develop, hotfixBranch, mergeResult);
        ErrorDialog.openError(null, UIText.HotfixFinishHandler_Conflicts, null, status);
    } catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException | InterruptedException e) {
        return error(e.getMessage(), e);
    }
    return null;
}
Also used : OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) MergeResult(org.eclipse.jgit.api.MergeResult) MultiStatus(org.eclipse.core.runtime.MultiStatus) IJobManager(org.eclipse.core.runtime.jobs.IJobManager) IOException(java.io.IOException) CoreException(org.eclipse.core.runtime.CoreException) MergeStatus(org.eclipse.jgit.api.MergeResult.MergeStatus) WrongGitFlowStateException(org.eclipse.egit.gitflow.WrongGitFlowStateException) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) HotfixFinishOperation(org.eclipse.egit.gitflow.op.HotfixFinishOperation)

Aggregations

IOException (java.io.IOException)1 CoreException (org.eclipse.core.runtime.CoreException)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 IJobManager (org.eclipse.core.runtime.jobs.IJobManager)1 GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)1 WrongGitFlowStateException (org.eclipse.egit.gitflow.WrongGitFlowStateException)1 HotfixFinishOperation (org.eclipse.egit.gitflow.op.HotfixFinishOperation)1 MergeResult (org.eclipse.jgit.api.MergeResult)1 MergeStatus (org.eclipse.jgit.api.MergeResult.MergeStatus)1