Search in sources :

Example 1 with ReleaseFinishOperation

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

the class GitFlowRepositoryTest method testGetHotfixBranches.

@Test
public void testGetHotfixBranches() throws Exception {
    repository1.createInitialCommit("testGetHotfixBranches\n\nfirst commit\n");
    Repository repository = repository1.getRepository();
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    new InitOperation(repository).execute(null);
    assertTrue(gfRepo.getHotfixBranches().isEmpty());
    new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
    new ReleaseFinishOperation(gfRepo, MY_RELEASE).execute(null);
    new HotfixStartOperation(gfRepo, MY_HOTFIX).execute(null);
    assertEquals(R_HEADS + gfRepo.getConfig().getHotfixPrefix() + MY_HOTFIX, gfRepo.getHotfixBranches().get(0).getName());
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) Repository(org.eclipse.jgit.lib.Repository) ReleaseFinishOperation(org.eclipse.egit.gitflow.op.ReleaseFinishOperation) ReleaseStartOperation(org.eclipse.egit.gitflow.op.ReleaseStartOperation) HotfixStartOperation(org.eclipse.egit.gitflow.op.HotfixStartOperation) InitOperation(org.eclipse.egit.gitflow.op.InitOperation) Test(org.junit.Test)

Example 2 with ReleaseFinishOperation

use of org.eclipse.egit.gitflow.op.ReleaseFinishOperation 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;
}
Also used : ReleaseFinishOperation(org.eclipse.egit.gitflow.op.ReleaseFinishOperation) 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)

Aggregations

ReleaseFinishOperation (org.eclipse.egit.gitflow.op.ReleaseFinishOperation)2 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 TestRepository (org.eclipse.egit.core.test.TestRepository)1 GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)1 WrongGitFlowStateException (org.eclipse.egit.gitflow.WrongGitFlowStateException)1 HotfixStartOperation (org.eclipse.egit.gitflow.op.HotfixStartOperation)1 InitOperation (org.eclipse.egit.gitflow.op.InitOperation)1 ReleaseStartOperation (org.eclipse.egit.gitflow.op.ReleaseStartOperation)1 MergeResult (org.eclipse.jgit.api.MergeResult)1 MergeStatus (org.eclipse.jgit.api.MergeResult.MergeStatus)1 Repository (org.eclipse.jgit.lib.Repository)1 Test (org.junit.Test)1