Search in sources :

Example 1 with HotfixStartOperation

use of org.eclipse.egit.gitflow.op.HotfixStartOperation 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 HotfixStartOperation

use of org.eclipse.egit.gitflow.op.HotfixStartOperation 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;
}
Also used : InputDialog(org.eclipse.jface.dialogs.InputDialog) HotfixStartOperation(org.eclipse.egit.gitflow.op.HotfixStartOperation) HotfixNameValidator(org.eclipse.egit.gitflow.ui.internal.validation.HotfixNameValidator) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository)

Aggregations

HotfixStartOperation (org.eclipse.egit.gitflow.op.HotfixStartOperation)2 TestRepository (org.eclipse.egit.core.test.TestRepository)1 GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)1 InitOperation (org.eclipse.egit.gitflow.op.InitOperation)1 ReleaseFinishOperation (org.eclipse.egit.gitflow.op.ReleaseFinishOperation)1 ReleaseStartOperation (org.eclipse.egit.gitflow.op.ReleaseStartOperation)1 HotfixNameValidator (org.eclipse.egit.gitflow.ui.internal.validation.HotfixNameValidator)1 InputDialog (org.eclipse.jface.dialogs.InputDialog)1 Repository (org.eclipse.jgit.lib.Repository)1 Test (org.junit.Test)1