Search in sources :

Example 1 with InitParameters

use of org.eclipse.egit.gitflow.InitParameters 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 2 with InitParameters

use of org.eclipse.egit.gitflow.InitParameters 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)

Aggregations

GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)2 InitParameters (org.eclipse.egit.gitflow.InitParameters)2 Repository (org.eclipse.jgit.lib.Repository)2 RevCommit (org.eclipse.jgit.revwalk.RevCommit)2 Test (org.junit.Test)2