use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class GitFlowHandlerUtil method gatherRevision.
static String gatherRevision(ExecutionEvent event) throws IOException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
if (gfRepo == null) {
throw new IllegalStateException(// $NON-NLS-1$
"Gitflow command called with no Gitflow repository present");
}
Ref develop = gfRepo.getRepository().exactRef(gfRepo.getConfig().getDevelopFull());
if (develop == null) {
throw new IllegalStateException(// $NON-NLS-1$
"Gitflow command called on Gitflow repository with no develop branch. " + // $NON-NLS-1$
"The Gitflow configuration is either corrupt or incomplete.");
}
return develop.getName();
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class HotfixFinishHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final GitFlowRepository gfRepo = GitFlowHandlerUtil.getRepository(event);
if (gfRepo == null) {
return error(UIText.Handlers_noGitflowRepositoryFound);
}
HotfixFinishOperation hotfixFinishOperation;
try {
hotfixFinishOperation = new HotfixFinishOperation(gfRepo);
String hotfixBranch = gfRepo.getRepository().getBranch();
String develop = gfRepo.getConfig().getDevelop();
JobUtil.scheduleUserWorkspaceJob(hotfixFinishOperation, UIText.HotfixFinishHandler_finishingHotfix, JobFamilies.GITFLOW_FAMILY);
IJobManager jobMan = Job.getJobManager();
jobMan.join(JobFamilies.GITFLOW_FAMILY, null);
MergeResult mergeResult = hotfixFinishOperation.getMergeResult();
MergeStatus mergeStatus = mergeResult.getMergeStatus();
if (!MergeStatus.CONFLICTING.equals(mergeStatus)) {
return null;
}
if (handleConflictsOnMaster(gfRepo)) {
return null;
}
MultiStatus status = createMergeConflictInfo(develop, hotfixBranch, mergeResult);
ErrorDialog.openError(null, UIText.HotfixFinishHandler_Conflicts, null, status);
} catch (WrongGitFlowStateException | CoreException | IOException | OperationCanceledException | InterruptedException e) {
return error(e.getMessage(), e);
}
return null;
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class CurrentBranchPublishOperationTest method testFeaturePublish.
@Test
public void testFeaturePublish() throws Exception {
new InitOperation(repository2.getRepository()).execute(null);
GitFlowRepository gfRepo2 = new GitFlowRepository(repository2.getRepository());
new FeatureStartOperation(gfRepo2, MY_FEATURE).execute(null);
RevCommit branchCommit = repository2.createInitialCommit("testFeaturePublish");
CurrentBranchPublishOperation featurePublishOperation = new CurrentBranchPublishOperation(gfRepo2, 0);
featurePublishOperation.execute(null);
PushOperationResult result = featurePublishOperation.getOperationResult();
assertTrue(result.isSuccessfulConnection(repository1.getUri()));
PushResult pushResult = result.getPushResult(repository1.getUri());
assertEquals(RefUpdate.Result.NEW, pushResult.getTrackingRefUpdates().iterator().next().getResult());
assertCommitArrivedAtRemote(branchCommit, repository1.getRepository());
// config updated?
assertEquals(DEFAULT_REMOTE_NAME, getRemoteName(gfRepo2, MY_FEATURE));
assertEquals(R_HEADS + gfRepo2.getConfig().getFeatureBranchName(MY_FEATURE), gfRepo2.getUpstreamBranchName(MY_FEATURE));
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureCheckoutOperationTest method testFeatureCheckout.
@Test
public void testFeatureCheckout() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureCheckout\n\nfirst commit\n");
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
new BranchOperation(repository, gfRepo.getConfig().getDevelop()).execute(null);
new FeatureCheckoutOperation(gfRepo, MY_FEATURE).execute(null);
assertEquals(gfRepo.getConfig().getFullFeatureBranchName(MY_FEATURE), repository.getFullBranch());
}
use of org.eclipse.egit.gitflow.GitFlowRepository in project egit by eclipse.
the class FeatureFinishOperationTest method testFeatureFinish.
@Test
public void testFeatureFinish() throws Exception {
Repository repository = testRepository.getRepository();
GitFlowRepository gfRepo = init("testFeatureFinish\n\nfirst commit\n");
new FeatureStartOperation(gfRepo, MY_FEATURE).execute(null);
addFileAndCommit("foo.txt", "testFeatureFinish\n\nbranch commit 1\n");
addFileAndCommit("bar.txt", "testFeatureFinish\n\nbranch commit 2\n");
new FeatureFinishOperation(gfRepo).execute(null);
assertEquals(gfRepo.getConfig().getDevelopFull(), repository.getFullBranch());
String branchName = gfRepo.getConfig().getFeatureBranchName(MY_FEATURE);
assertEquals(formatMergeCommitMessage(branchName) + " into develop", gfRepo.findHead().getFullMessage());
}
Aggregations