use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceAdapterTest method testDecorationIgnoredFile.
@Test
public void testDecorationIgnoredFile() throws Exception {
// Create new file
write(new File(project.getLocation().toFile(), "Test.dat"), "Something");
write(new File(project.getLocation().toFile(), TEST_FILE2), "Something");
write(new File(project.getLocation().toFile(), "Test"), "Something");
// Test is prefix of TestFile
write(new File(project.getLocation().toFile(), ".gitignore"), "Test");
project.refreshLocal(IResource.DEPTH_INFINITE, null);
IResource file = project.findMember("Test.dat");
IResource gitignore = project.findMember(".gitignore");
IResource test = project.findMember("Test");
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { new TestDecoratableResource(project).tracked().dirty(), new TestDecoratableResource(gitignore), new TestDecoratableResource(file), new TestDecoratableResource(test).ignored() };
waitForIndexDiffUpdate(true);
IndexDiffData indexDiffData = indexDiffCacheEntry.getIndexDiff();
IDecoratableResource[] actualDRs = { new DecoratableResourceAdapter(indexDiffData, project), new DecoratableResourceAdapter(indexDiffData, gitignore), new DecoratableResourceAdapter(indexDiffData, file), new DecoratableResourceAdapter(indexDiffData, test) };
assertArrayEquals(expectedDRs, actualDRs);
}
use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceMappingTest method testAnyDirtyIsDirty.
@Test
public void testAnyDirtyIsDirty() throws Exception {
gitAdd(git, rmContentA);
gitAdd(git, rmContentB);
gitCommit(git);
write(rmContentA.getLocation().toFile(), "Changed content");
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(rmContentA).tracked().dirty(), newExpectedDecoratableResource(rmContentB).tracked(), newExpectedDecoratableResourceMapping().tracked().dirty() };
IndexDiffData indexDiffData = waitForIndexDiff(true);
IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, rmContentA), newDecoratableResource(indexDiffData, rmContentB), newDecoratableResourceMapping(resourceMapping) };
assertArrayEquals(expectedDRs, actualDRs);
assertDecorationDirty(resourceMapping);
}
use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceMappingTest method testAnyTrackedIsTracked.
@Test
public void testAnyTrackedIsTracked() throws Exception {
gitAdd(git, rmContentA);
gitCommit(git);
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(rmContentA).tracked(), newExpectedDecoratableResource(rmContentB), newExpectedDecoratableResourceMapping().tracked() };
IndexDiffData indexDiffData = waitForIndexDiff(true);
IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, rmContentA), newDecoratableResource(indexDiffData, rmContentB), newDecoratableResourceMapping(resourceMapping) };
assertArrayEquals(expectedDRs, actualDRs);
assertDecorationTracked(resourceMapping);
}
use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceMappingTest method testMixedStagingStateIsModified_AddedNotStaged.
@Test
public void testMixedStagingStateIsModified_AddedNotStaged() throws Exception {
gitAdd(git, rmContentA);
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(rmContentA).tracked().added(), newExpectedDecoratableResource(rmContentB), newExpectedDecoratableResourceMapping().tracked().modified() };
IndexDiffData indexDiffData = waitForIndexDiff(true);
IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, rmContentA), newDecoratableResource(indexDiffData, rmContentB), newDecoratableResourceMapping(resourceMapping) };
assertArrayEquals(expectedDRs, actualDRs);
assertDecorationStaged(resourceMapping);
}
use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.
the class DecoratableResourceMappingTest method testAnyConflictsIsConflicts.
@Test
public void testAnyConflictsIsConflicts() throws Exception {
// commit changes on master
gitAdd(git, rmContentA);
gitAdd(git, rmContentB);
RevCommit masterCommit = gitCommit(git);
// add change on new branch first_topic
git.checkout().setCreateBranch(true).setName("first_topic").call();
rmContentA = findFile(project, RM_CONTENT_A_FILE_NAME);
write(rmContentA.getLocation().toFile(), "First Topic Content");
project.refreshLocal(IResource.DEPTH_INFINITE, null);
gitAdd(git, rmContentA);
RevCommit firstTopicCommit = gitCommit(git);
// add change on new branch second_topic
git.checkout().setCreateBranch(true).setStartPoint(masterCommit).setName("second_topic").call();
rmContentA = findFile(project, RM_CONTENT_A_FILE_NAME);
write(rmContentA.getLocation().toFile(), "Second Topic Content");
project.refreshLocal(IResource.DEPTH_INFINITE, null);
gitAdd(git, rmContentA);
gitCommit(git);
// merge second_topic with first_topic
MergeResult mergeResult = git.merge().include(firstTopicCommit).call();
assertEquals(MergeStatus.CONFLICTING, mergeResult.getMergeStatus());
IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(rmContentA).tracked().conflicts(), newExpectedDecoratableResource(rmContentB).tracked(), newExpectedDecoratableResourceMapping().tracked().conflicts() };
IndexDiffData indexDiffData = waitForIndexDiff(true);
IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, rmContentA), newDecoratableResource(indexDiffData, rmContentB), newDecoratableResourceMapping(resourceMapping) };
assertArrayEquals(expectedDRs, actualDRs);
assertDecorationConflicts(resourceMapping);
}
Aggregations