Search in sources :

Example 21 with GitFlowRepository

use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.

the class InitOperationTest method testInitEmptyRepository.

@Test
public void testInitEmptyRepository() throws Exception {
    Repository repository = testRepository.getRepository();
    InitOperation initOperation = new InitOperation(repository);
    initOperation.execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
}
Also used : GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Repository(org.eclipse.jgit.lib.Repository) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Test(org.junit.Test)

Example 22 with GitFlowRepository

use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.

the class ReleaseFinishOperationTest method testReleaseFinishFail.

@Test
public void testReleaseFinishFail() throws Exception {
    testRepository.createInitialCommit("testReleaseFinishFail\n\nfirst commit\n");
    Repository repository = testRepository.getRepository();
    new InitOperation(repository).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
    new BranchOperation(repository, gfRepo.getConfig().getDevelop()).execute(null);
    try {
        new ReleaseFinishOperation(gfRepo).execute(null);
        fail();
    } catch (WrongGitFlowStateException e) {
    // success
    }
}
Also used : GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Repository(org.eclipse.jgit.lib.Repository) BranchOperation(org.eclipse.egit.core.op.BranchOperation) WrongGitFlowStateException(org.eclipse.egit.gitflow.WrongGitFlowStateException) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Test(org.junit.Test)

Example 23 with GitFlowRepository

use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.

the class ReleaseFinishOperationTest method testReleaseTagWithWrongReferenceExists.

@Test
public void testReleaseTagWithWrongReferenceExists() throws Exception {
    testRepository.createInitialCommit("testReleaseTagExists\n\nfirst commit\n");
    testRepository.createInitialCommit("testReleaseTagExists\n\nsecond commit\n");
    Repository repository = testRepository.getRepository();
    new InitOperation(repository).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
    RevCommit next = getPreviousCommit(repository, 1);
    ReleaseFinishOperation releaseFinishOperation = new ReleaseFinishOperation(gfRepo);
    releaseFinishOperation.createTag(null, next, MY_RELEASE, "irrelevant");
    try {
        releaseFinishOperation.execute(null);
        fail();
    } catch (CoreException e) {
        assertFalse(e.getStatus().isOK());
    }
}
Also used : GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Repository(org.eclipse.jgit.lib.Repository) CoreException(org.eclipse.core.runtime.CoreException) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test)

Example 24 with GitFlowRepository

use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.

the class ReleaseFinishOperationTest method testReleaseTagWithCorrectReferenceExists.

@Test
public void testReleaseTagWithCorrectReferenceExists() throws Exception {
    testRepository.createInitialCommit("testReleaseTagExists\n\nfirst commit\n");
    Repository repository = testRepository.getRepository();
    new InitOperation(repository).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
    RevCommit next = getPreviousCommit(repository, 0);
    ReleaseFinishOperation releaseFinishOperation = new ReleaseFinishOperation(gfRepo);
    releaseFinishOperation.createTag(null, next, MY_RELEASE, "irrelevant");
    releaseFinishOperation.execute(null);
}
Also used : GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Repository(org.eclipse.jgit.lib.Repository) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test)

Example 25 with GitFlowRepository

use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.

the class ReleaseStartOperationTest method testReleaseStartFailed.

@Test
public void testReleaseStartFailed() throws Exception {
    testRepository.createInitialCommit("testReleaseStart\n\nfirst commit\n");
    Repository repository = testRepository.getRepository();
    new InitOperation(repository).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    createTag(gfRepo.findHead(), MY_RELEASE, "irrelevant", repository);
    try {
        new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
        fail();
    } catch (CoreException e) {
        assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
    }
}
Also used : GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Repository(org.eclipse.jgit.lib.Repository) CoreException(org.eclipse.core.runtime.CoreException) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Test(org.junit.Test)

Aggregations

GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)57 Repository (org.eclipse.jgit.lib.Repository)35 Test (org.junit.Test)33 RevCommit (org.eclipse.jgit.revwalk.RevCommit)19 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)7 BranchOperation (org.eclipse.egit.core.op.BranchOperation)7 IOException (java.io.IOException)6 CoreException (org.eclipse.core.runtime.CoreException)6 Shell (org.eclipse.swt.widgets.Shell)6 IJobManager (org.eclipse.core.runtime.jobs.IJobManager)5 WrongGitFlowStateException (org.eclipse.egit.gitflow.WrongGitFlowStateException)5 File (java.io.File)4 Ref (org.eclipse.jgit.lib.Ref)4 GitFlowConfig (org.eclipse.egit.gitflow.GitFlowConfig)3 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)3 ExecutionException (org.eclipse.core.commands.ExecutionException)2 MultiStatus (org.eclipse.core.runtime.MultiStatus)2 InitParameters (org.eclipse.egit.gitflow.InitParameters)2 FeatureBranchSelectionDialog (org.eclipse.egit.gitflow.ui.internal.dialogs.FeatureBranchSelectionDialog)2 InputDialog (org.eclipse.jface.dialogs.InputDialog)2