Search in sources :

Example 36 with GitFlowRepository

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

the class ReleaseFinishOperationTest method testReleaseFinishSingleCommit.

@Test
public void testReleaseFinishSingleCommit() throws Exception {
    testRepository.createInitialCommit("testReleaseFinish\n\nfirst commit\n");
    Repository repository = testRepository.getRepository();
    InitParameters initParameters = new InitParameters();
    initParameters.setDevelop(DEVELOP);
    initParameters.setMaster(MASTER);
    initParameters.setFeature(FEATURE_PREFIX);
    initParameters.setRelease(RELEASE_PREFIX);
    initParameters.setHotfix(HOTFIX_PREFIX);
    initParameters.setVersionTag(MY_VERSION_TAG);
    new InitOperation(repository, initParameters).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
    RevCommit branchCommit = testRepository.createInitialCommit("testReleaseFinish\n\nbranch commit\n");
    new ReleaseFinishOperation(gfRepo).execute(null);
    assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
    String branchName = gfRepo.getConfig().getReleaseBranchName(MY_RELEASE);
    // tag created?
    RevCommit taggedCommit = gfRepo.findCommitForTag(MY_VERSION_TAG + MY_RELEASE);
    assertEquals(formatMergeCommitMessage(branchName), taggedCommit.getShortMessage());
    // branch removed?
    assertEquals(findBranch(repository, branchName), null);
    RevCommit developHead = gfRepo.findHead(DEVELOP);
    assertNotEquals(branchCommit, developHead);
    RevCommit masterHead = gfRepo.findHead(MY_MASTER);
    assertEquals(formatMergeCommitMessage(branchName), masterHead.getShortMessage());
}
Also used : GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Repository(org.eclipse.jgit.lib.Repository) InitParameters(org.eclipse.egit.gitflow.InitParameters) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test)

Example 37 with GitFlowRepository

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

the class ReleaseFinishOperationTest method testReleaseFinish.

@Test
public void testReleaseFinish() throws Exception {
    testRepository.createInitialCommit("testReleaseFinish\n\nfirst commit\n");
    Repository repository = testRepository.getRepository();
    InitParameters initParameters = new InitParameters();
    initParameters.setDevelop(DEVELOP);
    initParameters.setMaster(MASTER);
    initParameters.setFeature(FEATURE_PREFIX);
    initParameters.setRelease(RELEASE_PREFIX);
    initParameters.setHotfix(HOTFIX_PREFIX);
    initParameters.setVersionTag(MY_VERSION_TAG);
    new InitOperation(repository, initParameters).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
    addFileAndCommit("foo.txt", "testReleaseFinish\n\nbranch commit 1\n");
    addFileAndCommit("bar.txt", "testReleaseFinish\n\nbranch commit 2\n");
    ReleaseFinishOperation releaseFinishOperation = new ReleaseFinishOperation(gfRepo);
    releaseFinishOperation.execute(null);
    assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
    String branchName = gfRepo.getConfig().getReleaseBranchName(MY_RELEASE);
    // tag created?
    RevCommit taggedCommit = gfRepo.findCommitForTag(MY_VERSION_TAG + MY_RELEASE);
    assertEquals(formatMergeCommitMessage(branchName), taggedCommit.getFullMessage());
    // branch removed?
    assertEquals(findBranch(repository, branchName), null);
}
Also used : GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Repository(org.eclipse.jgit.lib.Repository) InitParameters(org.eclipse.egit.gitflow.InitParameters) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test)

Example 38 with GitFlowRepository

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

the class ReleaseStartOperationTest method testReleaseBranchCreated.

@Test
public void testReleaseBranchCreated() throws Exception {
    testRepository.createInitialCommit("testReleaseBranchCreated\n\nfirst commit\n");
    Repository repository = testRepository.getRepository();
    new InitOperation(repository).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation(gfRepo, MY_RELEASE);
    releaseStartOperation.execute(null);
    assertNull(releaseStartOperation.getSchedulingRule());
    assertEquals(gfRepo.getConfig().getFullReleaseBranchName(MY_RELEASE), 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 39 with GitFlowRepository

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

the class ReleaseStartOperationTest method testReleaseStartWithContent.

@Test
public void testReleaseStartWithContent() throws Exception {
    testRepository.createInitialCommit("testReleaseStartWithContent\n\nfirst commit\n");
    Repository repository = testRepository.getRepository();
    new InitOperation(repository).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    testUtils.addFileToProject(project.getProject(), "folder1/file1.txt", "Hello world");
    testRepository.connect(project.getProject());
    testRepository.trackAllFiles(project.getProject());
    RevCommit developCommit = testRepository.commit("Initial commit");
    new ReleaseStartOperation(gfRepo, MY_RELEASE).execute(null);
    RevCommit releaseHead = gfRepo.findHead(gfRepo.getConfig().getReleaseBranchName(MY_RELEASE));
    assertEquals(developCommit, releaseHead);
}
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 40 with GitFlowRepository

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

the class ReleaseStartOperationTest method testReleaseBranchCreatedFromHeadCommit.

@Test
public void testReleaseBranchCreatedFromHeadCommit() throws Exception {
    RevCommit initialCommit = testRepository.createInitialCommit("testReleaseBranchCreatedFromHeadCommit\n\nfirst commit\n");
    Repository repository = testRepository.getRepository();
    new InitOperation(repository).execute(null);
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation(gfRepo, initialCommit.getName(), MY_RELEASE);
    releaseStartOperation.execute(null);
    assertNull(releaseStartOperation.getSchedulingRule());
    assertEquals(gfRepo.getConfig().getFullReleaseBranchName(MY_RELEASE), repository.getFullBranch());
}
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)

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