Search in sources :

Example 1 with GitFlowRepository

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

the class FeatureStartFinishHandlerTest method testFeatureStart.

@Test
public void testFeatureStart() throws Exception {
    init();
    setContentAddAndCommit("bar");
    createFeature(FEATURE_NAME);
    RevCommit featureBranchCommit = setContentAddAndCommit("foo");
    checkoutBranch(DEVELOP);
    checkoutFeature(FEATURE_NAME);
    finishFeature();
    GitFlowRepository gfRepo = new GitFlowRepository(repository);
    RevCommit developHead = gfRepo.findHead();
    assertEquals(developHead, featureBranchCommit);
    assertNull(findBranch(gfRepo.getConfig().getFeatureBranchName(FEATURE_NAME)));
    IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
    assertFalse(prefStore.getBoolean(FEATURE_FINISH_SQUASH));
    assertFalse(prefStore.getBoolean(FEATURE_FINISH_KEEP_BRANCH));
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) RevCommit(org.eclipse.jgit.revwalk.RevCommit) Test(org.junit.Test)

Example 2 with GitFlowRepository

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

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

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

the class AbstractDualRepositoryTestCase method assertCommitArrivedAtRemote.

protected void assertCommitArrivedAtRemote(RevCommit branchCommit, Repository remote) throws CoreException {
    GitFlowRepository gfRepo = new GitFlowRepository(remote);
    BranchOperation checkoutOperation = new BranchOperation(remote, gfRepo.getConfig().getFullFeatureBranchName(MY_FEATURE));
    checkoutOperation.execute(null);
    RevCommit developHead = findHead(remote);
    assertEquals(branchCommit, developHead);
}
Also used : BranchOperation(org.eclipse.egit.core.op.BranchOperation) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

Example 5 with GitFlowRepository

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

the class DynamicHistoryMenu method fill.

@Override
public void fill(Menu menu, int index) {
    GitFlowRepository gfRepo = getRepository();
    if (gfRepo == null) {
        return;
    }
    RevCommit selectedCommit = getSelectedCommit();
    if (selectedCommit == null) {
        return;
    }
    String startCommitSha1 = selectedCommit.getName();
    Shell activeShell = getActiveShell();
    ReleaseStartFromCommitHandler listener = new ReleaseStartFromCommitHandler(gfRepo, startCommitSha1, activeShell);
    MenuItem menuItem = new MenuItem(menu, SWT.PUSH, index);
    menuItem.setText(NLS.bind(UIText.DynamicHistoryMenu_startGitflowReleaseFrom, abbreviate(selectedCommit)));
    menuItem.addSelectionListener(listener);
    boolean isEnabled = false;
    try {
        isEnabled = gfRepo.isOnDevelop(selectedCommit);
    } catch (IOException e) {
        Activator.getDefault().getLog().log(error(e.getMessage(), e));
    }
    menuItem.setEnabled(isEnabled);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ReleaseStartFromCommitHandler(org.eclipse.egit.gitflow.ui.internal.actions.ReleaseStartFromCommitHandler) MenuItem(org.eclipse.swt.widgets.MenuItem) IOException(java.io.IOException) GitFlowRepository(org.eclipse.egit.gitflow.GitFlowRepository) RevCommit(org.eclipse.jgit.revwalk.RevCommit)

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