use of org.eclipse.egit.core.op.MergeOperation in project egit by eclipse.
the class MergeWithPreferredStrategyTest method testMergeUsesPreferredStrategyRegisteredWithExplicitName.
@Test
public void testMergeUsesPreferredStrategyRegisteredWithExplicitName() throws Exception {
InstanceScope.INSTANCE.getNode(Activator.getPluginId()).put(GitCorePreferences.core_preferredMergeStrategy, "org.eclipse.egit.core.test.theirs");
MergeOperation operation = new MergeOperation(testRepository.getRepository(), SIDE);
operation.execute(new NullProgressMonitor());
// With the MergeStrategy THEIRS, new files from branch 'master' should
// be ignored and new files from branch 'side' should be present
assertEquals(4, countCommitsInHead());
assertFalse(testRepository.getIFile(project.getProject(), file2).exists());
assertTrue(testRepository.getIFile(project.getProject(), file3).exists());
}
use of org.eclipse.egit.core.op.MergeOperation in project egit by eclipse.
the class MergeToolTest method useHeadOptionShouldCauseFileToNotHaveConflictMarkers.
@Test
public void useHeadOptionShouldCauseFileToNotHaveConflictMarkers() throws Exception {
IPath path = new Path(PROJ1).append("folder/test.txt");
testRepository.branch("stable").commit().add(path.toString(), "stable").create();
touchAndSubmit("master", "master");
MergeOperation mergeOp = new MergeOperation(testRepository.getRepository(), "stable");
mergeOp.execute(null);
MergeResult mergeResult = mergeOp.getResult();
assertThat(mergeResult.getMergeStatus(), is(MergeStatus.CONFLICTING));
assertThat(mergeResult.getConflicts().keySet(), hasItem(path.toString()));
IndexDiffCache cache = Activator.getDefault().getIndexDiffCache();
cache.getIndexDiffCacheEntry(testRepository.getRepository());
TestUtil.joinJobs(JobFamilies.INDEX_DIFF_CACHE_UPDATE);
SWTBotTree packageExplorer = TestUtil.getExplorerTree();
SWTBotTreeItem project1 = getProjectItem(packageExplorer, PROJ1).select();
SWTBotTreeItem folderNode = TestUtil.expandAndWait(project1).getNode(FOLDER);
SWTBotTreeItem fileNode = TestUtil.expandAndWait(folderNode).getNode(FILE1);
fileNode.select();
ContextMenuHelper.clickContextMenu(packageExplorer, util.getPluginLocalizedValue("TeamMenu.label"), util.getPluginLocalizedValue("MergeToolAction.label"));
CompareEditorTester compareEditor = CompareEditorTester.forTitleContaining("Merging");
String text = compareEditor.getLeftEditor().getText();
assertThat(text, is("master"));
}
use of org.eclipse.egit.core.op.MergeOperation in project egit by eclipse.
the class MergeOperationTest method testMergeoptionsNoFF.
@Test
public void testMergeoptionsNoFF() throws Exception {
setMergeOptions("side", FastForwardMode.NO_FF);
MergeOperation operation = new MergeOperation(testRepository.getRepository(), MASTER);
operation.execute(new NullProgressMonitor());
assertEquals(3, countCommitsInHead());
}
use of org.eclipse.egit.core.op.MergeOperation in project egit by eclipse.
the class MergeOperationTest method testMergeoptionsFFOnly.
@Test
public void testMergeoptionsFFOnly() throws Exception {
setMergeOptions("side", FastForwardMode.FF_ONLY);
File file2 = testRepository.createFile(project.getProject(), "file2");
testRepository.appendFileContent(file2, "file2-1");
RevCommit commit = testRepository.addAndCommit(project.getProject(), file2, "side commit 1");
MergeOperation operation = new MergeOperation(testRepository.getRepository(), MASTER);
operation.execute(new NullProgressMonitor());
assertTrue(testRepository.getRepository().resolve(SIDE).equals(commit));
}
Aggregations