Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-01-24 15:57:58 +0000
committerJean Michel-Lemieux2002-01-24 15:57:58 +0000
commit70403d78dc96a5f04f3efa86b3f4ca20f79a1214 (patch)
tree8b152d68defb580de4c25ad3243e6b2076333f53
parent081e76d57ef01593c98d74ef88e6ddafae54c83c (diff)
downloadeclipse.platform.team-70403d78dc96a5f04f3efa86b3f4ca20f79a1214.tar.gz
eclipse.platform.team-70403d78dc96a5f04f3efa86b3f4ca20f79a1214.tar.xz
eclipse.platform.team-70403d78dc96a5f04f3efa86b3f4ca20f79a1214.zip
Added a test for merging.
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java44
1 files changed, 42 insertions, 2 deletions
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java
index 2f67a133c..e95538925 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/SyncElementTest.java
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.ILocalSyncElement;
+import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
@@ -50,7 +51,7 @@ public class SyncElementTest extends EclipseTest {
public static Test suite() {
TestSuite suite = new TestSuite(SyncElementTest.class);
return new CVSTestSetup(suite);
- //return new CVSTestSetup(new SyncElementTest("testGranularityContents"));
+ //return new CVSTestSetup(new SyncElementTest("testSimpleMerge"));
}
/*
@@ -694,4 +695,43 @@ public class SyncElementTest extends EclipseTest {
assertEquals("Base is incorrect", (ICVSResource)tree.getBase(), Session.getManagedResource(copy), false, false);
}
-}
+
+ public void testSimpleMerge() throws TeamException, CoreException, IOException {
+ // Create a test project (which commits it as well)
+ IProject project = createProject("testSimpleMerge", new String[] { "file1.txt", "file2.txt", "file3.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
+
+ // Checkout and modify a copy
+ IProject copy = checkoutCopy(project, "-copy");
+ copy.refreshLocal(IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+
+ getProvider(project).tag(new IResource[] {project}, IResource.DEPTH_INFINITE, new CVSTag("v1", CVSTag.VERSION), DEFAULT_MONITOR);
+ getProvider(project).tag(new IResource[] {project}, IResource.DEPTH_INFINITE, new CVSTag("branch1", CVSTag.BRANCH), DEFAULT_MONITOR);
+
+ getProvider(copy).update(new IResource[] {copy}, IResource.DEPTH_INFINITE, new CVSTag("branch1", CVSTag.BRANCH), false, DEFAULT_MONITOR);
+
+ // make changes on the branch
+ addResources(copy, new String[] {"addition.txt", "folderAddition/", "folderAddition/new.txt"}, true);
+ deleteResources(copy, new String[] {"folder1/b.txt"}, true);
+ changeResources(copy, new String[] {"file1.txt", "file2.txt"}, true);
+
+ // make change to workspace working on HEAD
+ changeResources(project, new String[] {"file2.txt"}, false);
+ changeResources(project, new String[] {"file3.txt"}, true);
+
+ IRemoteResource base = getProvider(project).getRemoteTree(project, new CVSTag("v1", CVSTag.VERSION), DEFAULT_MONITOR);
+ IRemoteResource remote = getProvider(project).getRemoteTree(project, new CVSTag("branch1", CVSTag.BRANCH), DEFAULT_MONITOR);
+ IRemoteSyncElement tree = new CVSRemoteSyncElement(false, project, base, remote);
+
+ // watch for empty directories and the prune option!!!
+ assertSyncEquals("testSimpleMerge sync check", tree,
+ new String[] { "addition.txt", "folderAddition/", "folderAddition/new.txt",
+ "folder1/b.txt", "file1.txt", "file2.txt", "file3.txt"},
+ new int[] { IRemoteSyncElement.INCOMING | IRemoteSyncElement.ADDITION,
+ IRemoteSyncElement.INCOMING | IRemoteSyncElement.ADDITION,
+ IRemoteSyncElement.INCOMING | IRemoteSyncElement.ADDITION,
+ IRemoteSyncElement.INCOMING | IRemoteSyncElement.DELETION,
+ IRemoteSyncElement.INCOMING | IRemoteSyncElement.CHANGE,
+ IRemoteSyncElement.CONFLICTING | IRemoteSyncElement.CHANGE,
+ IRemoteSyncElement.OUTGOING | IRemoteSyncElement.CHANGE });
+ }
+} \ No newline at end of file

Back to the top