Search in sources :

Example 11 with IndexDiffData

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.

the class DecoratableResourceMappingTest method testNewResourceMappingIsUnstaged.

@Test
public void testNewResourceMappingIsUnstaged() throws Exception {
    IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(rmContentA), newExpectedDecoratableResource(rmContentB), newExpectedDecoratableResourceMapping() };
    IndexDiffData indexDiffData = waitForIndexDiff(true);
    IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, rmContentA), newDecoratableResource(indexDiffData, rmContentB), newDecoratableResourceMapping(resourceMapping) };
    assertArrayEquals(expectedDRs, actualDRs);
    assertDecorationUntracked(resourceMapping);
}
Also used : IndexDiffData(org.eclipse.egit.core.internal.indexdiff.IndexDiffData) Test(org.junit.Test)

Example 12 with IndexDiffData

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.

the class DecoratableResourceMappingTest method testAllIgnoredIsUnstaged.

@Test
public void testAllIgnoredIsUnstaged() throws Exception {
    IFile gitignore = createFile(project, ".gitignore", "*.testrm_*");
    gitAdd(git, gitignore);
    gitAdd(git, rmContentA);
    gitAdd(git, rmContentB);
    gitCommit(git);
    project.refreshLocal(IResource.DEPTH_INFINITE, null);
    rmContentA = findFile(project, RM_CONTENT_A_FILE_NAME);
    gitignore = findFile(project, ".gitignore");
    IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(gitignore).tracked(), newExpectedDecoratableResource(rmContentA).ignored(), newExpectedDecoratableResource(rmContentB).ignored(), newExpectedDecoratableResourceMapping() };
    IndexDiffData indexDiffData = waitForIndexDiff(true);
    IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, gitignore), newDecoratableResource(indexDiffData, rmContentA), newDecoratableResource(indexDiffData, rmContentB), newDecoratableResourceMapping(resourceMapping) };
    assertArrayEquals(expectedDRs, actualDRs);
    assertDecorationUntracked(resourceMapping);
}
Also used : IFile(org.eclipse.core.resources.IFile) IndexDiffData(org.eclipse.egit.core.internal.indexdiff.IndexDiffData) Test(org.junit.Test)

Example 13 with IndexDiffData

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.

the class DecoratableResourceMappingTest method testSameStagingStateIsState_Added.

@Test
public void testSameStagingStateIsState_Added() throws Exception {
    gitAdd(git, rmContentA);
    gitAdd(git, rmContentB);
    IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(rmContentA).tracked().added(), newExpectedDecoratableResource(rmContentB).tracked().added(), newExpectedDecoratableResourceMapping().tracked().added() };
    IndexDiffData indexDiffData = waitForIndexDiff(true);
    IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, rmContentA), newDecoratableResource(indexDiffData, rmContentB), newDecoratableResourceMapping(resourceMapping) };
    assertArrayEquals(expectedDRs, actualDRs);
    assertDecorationAdded(resourceMapping);
}
Also used : IndexDiffData(org.eclipse.egit.core.internal.indexdiff.IndexDiffData) Test(org.junit.Test)

Example 14 with IndexDiffData

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.

the class DecoratableWorkingSetTest method testUntrackedContentIsUndecorated.

@Test
public void testUntrackedContentIsUndecorated() throws Exception {
    setWorkingSet(project2);
    IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(project2), newExpectedDecoratableWorkingSet(WORKING_SET) };
    IndexDiffData indexDiffData = waitForIndexDiff(true);
    IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, project2), newDecoratableWorkingSet(resourceMapping) };
    assertArrayEquals(expectedDRs, actualDRs);
    assertUndecorated(resourceMapping);
}
Also used : IndexDiffData(org.eclipse.egit.core.internal.indexdiff.IndexDiffData) Test(org.junit.Test)

Example 15 with IndexDiffData

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffData in project egit by eclipse.

the class DecoratableWorkingSetTest method testStagingStateHasNoInfluence_Modified.

@Test
public void testStagingStateHasNoInfluence_Modified() throws Exception {
    IFile file = createFile(project1, TEST_FILE, "Something");
    gitAdd(git, file);
    IDecoratableResource[] expectedDRs = new IDecoratableResource[] { newExpectedDecoratableResource(project1).tracked().modified(), newExpectedDecoratableResource(file).tracked().added(), newExpectedDecoratableResource(project2), newExpectedDecoratableWorkingSet(WORKING_SET).tracked() };
    IndexDiffData indexDiffData = waitForIndexDiff(true);
    IDecoratableResource[] actualDRs = { newDecoratableResource(indexDiffData, project1), newDecoratableResource(indexDiffData, file), newDecoratableResource(indexDiffData, project2), newDecoratableWorkingSet(resourceMapping) };
    assertArrayEquals(expectedDRs, actualDRs);
    assertDecorationTracked(resourceMapping);
}
Also used : IFile(org.eclipse.core.resources.IFile) IndexDiffData(org.eclipse.egit.core.internal.indexdiff.IndexDiffData) Test(org.junit.Test)

Aggregations

IndexDiffData (org.eclipse.egit.core.internal.indexdiff.IndexDiffData)47 Test (org.junit.Test)34 IResource (org.eclipse.core.resources.IResource)14 File (java.io.File)11 IFile (org.eclipse.core.resources.IFile)10 IndexDiffCacheEntry (org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry)9 RevCommit (org.eclipse.jgit.revwalk.RevCommit)6 IFolder (org.eclipse.core.resources.IFolder)4 MergeResult (org.eclipse.jgit.api.MergeResult)4 Repository (org.eclipse.jgit.lib.Repository)4 IOException (java.io.IOException)3 CoreException (org.eclipse.core.runtime.CoreException)3 IndexDiffCache (org.eclipse.egit.core.internal.indexdiff.IndexDiffCache)3 Collection (java.util.Collection)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 IndexDiffChangedListener (org.eclipse.egit.core.internal.indexdiff.IndexDiffChangedListener)2