use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class DevelopCheckoutHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
if (gfRepo == null) {
return error(UIText.Handlers_noGitflowRepositoryFound);
}
BranchOperationUI.checkout(gfRepo.getRepository(), gfRepo.getConfig().getDevelopFull()).start();
return null;
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class ReleaseStartHandler method getStartCommit.
private String getStartCommit(ExecutionEvent event) throws ExecutionException {
ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
IStructuredSelection selection = SelectionUtils.getStructuredSelection(currentSelection);
if (selection.getFirstElement() instanceof PlotCommit) {
RevCommit plotCommit = (RevCommit) selection.getFirstElement();
return plotCommit.getName();
} else {
GitFlowRepository gitFlowRepository = GitFlowHandlerUtil.getRepository(event);
if (gitFlowRepository == null) {
throw new ExecutionException(UIText.ReleaseStartHandler_startCommitCouldNotBeDetermined);
}
RevCommit head;
try {
head = gitFlowRepository.findHead();
} catch (WrongGitFlowStateException e) {
throw new ExecutionException(e.getMessage(), e);
}
return head.getName();
}
}
use of org.eclipse.egit.gitflow.GitFlowRepository 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));
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureFinishKeepBranchHandlerTest method testFeatureFinishKeepBranch.
@Test
public void testFeatureFinishKeepBranch() 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);
assertNotNull(findBranch(gfRepo.getConfig().getFeatureBranchName(FEATURE_NAME)));
IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
assertFalse(prefStore.getBoolean(FEATURE_FINISH_SQUASH));
assertTrue(prefStore.getBoolean(FEATURE_FINISH_KEEP_BRANCH));
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureFinishSquashHandlerTest method testFeatureFinishSquash.
@Test
public void testFeatureFinishSquash() throws Exception {
int expectedCommitCount = 2;
init();
setContentAddAndCommit("bar");
expectedCommitCount++;
createFeature(FEATURE_NAME);
RevCommit commit1 = setContentAddAndCommit("commit 1");
expectedCommitCount++;
RevCommit commit2 = setContentAddAndCommit("commit 2");
expectedCommitCount++;
checkoutBranch(DEVELOP);
checkoutFeature(FEATURE_NAME);
finishFeature();
expectedCommitCount--;
RevCommit developHead = new GitFlowRepository(repository).findHead();
assertNotEquals(developHead, commit1);
assertNotEquals(developHead, commit2);
assertEquals(expectedCommitCount, countCommits());
assertTrue(developHead.getFullMessage().startsWith(SQUASHED_COMMENT_SUMMARY));
IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
assertTrue(prefStore.getBoolean(FEATURE_FINISH_SQUASH));
assertFalse(prefStore.getBoolean(FEATURE_FINISH_KEEP_BRANCH));
}
Aggregations