Search in sources :

Example 1 with GitFlowConfig

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

the class InitHandlerTest method testInitEmptyRepoMissingMaster.

@Test
public void testInitEmptyRepoMissingMaster() throws Exception {
    String projectName = "AnyProjectName";
    TestRepository testRepository = createAndShare(projectName);
    selectProject(projectName);
    clickInit();
    bot.button("Yes").click();
    fillDialog(MASTER_BRANCH_MISSING);
    bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing));
    bot.button("Yes").click();
    bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
    Repository localRepository = testRepository.getRepository();
    GitFlowRepository gitFlowRepository = new GitFlowRepository(localRepository);
    GitFlowConfig config = gitFlowRepository.getConfig();
    assertEquals(DEVELOP_BRANCH, localRepository.getBranch());
    assertEquals(MASTER_BRANCH_MISSING, config.getMaster());
    assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix());
    assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix());
    assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix());
    assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix());
    assertNotNull(localRepository.exactRef(Constants.R_HEADS + DEVELOP_BRANCH));
}
Also used : TestRepository(org.eclipse.egit.core.test.TestRepository) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) TestRepository(org.eclipse.egit.core.test.TestRepository) Repository(org.eclipse.jgit.lib.Repository) GitFlowConfig(org.eclipse.egit.gitflow.GitFlowConfig) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Test(org.junit.Test)

Example 2 with GitFlowConfig

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

the class InitHandlerTest method testInit.

@Test
public void testInit() throws Exception {
    selectProject(PROJ1);
    clickInit();
    fillDialog(MASTER_BRANCH);
    bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
    GitFlowRepository gitFlowRepository = new GitFlowRepository(repository);
    GitFlowConfig config = gitFlowRepository.getConfig();
    assertEquals(DEVELOP_BRANCH, repository.getBranch());
    assertEquals(MASTER_BRANCH, config.getMaster());
    assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix());
    assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix());
    assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix());
    assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix());
}
Also used : GitFlowConfig(org.eclipse.egit.gitflow.GitFlowConfig) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Test(org.junit.Test)

Example 3 with GitFlowConfig

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

the class ReleaseStartOperation method findHead.

private static String findHead(GitFlowRepository repository) {
    GitFlowConfig config = repository.getConfig();
    RevCommit head = repository.findHead(config.getDevelop());
    if (head == null) {
        throw new IllegalStateException(NLS.bind(CoreText.StartOperation_unableToFindCommitFor, config.getDevelop()));
    }
    return head.getName();
}
Also used : GitFlowConfig(org.eclipse.egit.gitflow.GitFlowConfig) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 4 with GitFlowConfig

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

the class FeatureStartOperation method execute.

@Override
public void execute(IProgressMonitor monitor) throws CoreException {
    GitFlowConfig config = repository.getConfig();
    String branchName = config.getFeatureBranchName(featureName);
    RevCommit head = repository.findHead(config.getDevelop());
    if (head == null) {
        throw new IllegalStateException(NLS.bind(CoreText.StartOperation_unableToFindCommitFor, config.getDevelop()));
    }
    start(monitor, branchName, head);
}
Also used : GitFlowConfig(org.eclipse.egit.gitflow.GitFlowConfig) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 5 with GitFlowConfig

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

the class InitHandlerTest method testInitMissingMaster.

@Test
public void testInitMissingMaster() throws Exception {
    selectProject(PROJ1);
    clickInit();
    fillDialog(MASTER_BRANCH_MISSING);
    bot.waitUntil(shellIsActive(UIText.InitDialog_masterBranchIsMissing));
    bot.button("Yes").click();
    bot.waitUntil(Conditions.waitForJobs(JobFamilies.GITFLOW_FAMILY, "Git flow jobs"));
    GitFlowRepository gitFlowRepository = new GitFlowRepository(repository);
    GitFlowConfig config = gitFlowRepository.getConfig();
    assertEquals(DEVELOP_BRANCH, repository.getBranch());
    assertEquals(MASTER_BRANCH_MISSING, config.getMaster());
    assertEquals(FEATURE_BRANCH_PREFIX, config.getFeaturePrefix());
    assertEquals(RELEASE_BRANCH_PREFIX, config.getReleasePrefix());
    assertEquals(HOTFIX_BRANCH_PREFIX, config.getHotfixPrefix());
    assertEquals(VERSION_TAG_PREFIX, config.getVersionTagPrefix());
    assertNotNull(repository.exactRef(Constants.R_HEADS + DEVELOP_BRANCH));
}
Also used : GitFlowConfig(org.eclipse.egit.gitflow.GitFlowConfig) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) Test(org.junit.Test)

Aggregations

GitFlowConfig (org.eclipse.egit.gitflow.GitFlowConfig)8 GitFlowRepository (org.eclipse.egit.gitflow.GitFlowRepository)3 RevCommit (org.eclipse.jgit.revwalk.RevCommit)3 Test (org.junit.Test)3 TestRepository (org.eclipse.egit.core.test.TestRepository)1 Repository (org.eclipse.jgit.lib.Repository)1