Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-09-11 11:49:59 -0400
committerJean Michel-Lemieux2003-09-11 11:49:59 -0400
commit7c8ac9f2d31cd66757d4c7a171fa3128ceb5ca39 (patch)
tree5b181c03710bc6a8904d979a4f0b6453f69888e0
parent3b0f1ccf14bf43c9235a554028d39265553f1bc0 (diff)
downloadeclipse.platform.team-7c8ac9f2d31cd66757d4c7a171fa3128ceb5ca39.tar.gz
eclipse.platform.team-7c8ac9f2d31cd66757d4c7a171fa3128ceb5ca39.tar.xz
eclipse.platform.team-7c8ac9f2d31cd66757d4c7a171fa3128ceb5ca39.zip
Mark as merged didn't work when remote was deleted.
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java3
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java63
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java25
4 files changed, 89 insertions, 4 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
index 457994ae0..1684244a7 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMergeSubscriber.java
@@ -302,7 +302,8 @@ public class CVSMergeSubscriber extends CVSSyncTreeSubscriber implements IResour
}
public boolean isMerged(IResource resource) throws TeamException {
- return mergedSynchronizer.getSyncBytes(resource) != null;
+ return (mergedSynchronizer.getSyncBytes(resource) != null ||
+ mergedSynchronizer.isRemoteKnown(resource));
}
/*
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
index e8c8b0f9a..a5d8953d8 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
@@ -31,6 +31,7 @@ import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberConfirmMergedAction;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.ui.sync.SyncInfoSet;
@@ -75,7 +76,14 @@ public class CVSMergeSubscriberTest extends CVSSyncSubscriberTest {
private void mergeResources(TeamSubscriber subscriber, SyncInfo[] infos, boolean allowOverwrite) throws TeamException, InvocationTargetException, InterruptedException {
TestMergeUpdateAction action = new TestMergeUpdateAction(allowOverwrite);
- action.setSubscriber(subscriber);
+ action.getRunnable(new SyncInfoSet(infos)).run(DEFAULT_MONITOR);
+ }
+
+
+ private void markAsMerged(CVSMergeSubscriber subscriber, IProject project, String[] resourcePaths) throws CoreException, TeamException, InvocationTargetException, InterruptedException {
+ IResource[] resources = getResources(project, resourcePaths);
+ SyncInfo[] infos = createSyncInfos(subscriber, resources);
+ TestMarkAsMergedAction action = new TestMarkAsMergedAction();
action.getRunnable(new SyncInfoSet(infos)).run(DEFAULT_MONITOR);
}
@@ -386,4 +394,57 @@ public class CVSMergeSubscriberTest extends CVSSyncSubscriberTest {
cvsProject.unmanage(new NullProgressMonitor());
assertProjectRemoved(subscriber, project);
}
+
+ public void testMarkAsMerged() throws IOException, TeamException, CoreException, InvocationTargetException, InterruptedException {
+ // Create a test project
+ IProject project = createProject("testMarkAsMerged", new String[] { "delete.txt", "file1.txt", "file2.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
+ setContentsAndEnsureModified(project.getFile("file1.txt"), "some text\nwith several lines\n");
+ setContentsAndEnsureModified(project.getFile("file2.txt"), "some text\nwith several lines\n");
+ commitProject(project);
+
+ // Checkout and branch a copy
+ CVSTag root = new CVSTag("root_branch1", CVSTag.VERSION);
+ CVSTag branch = new CVSTag("branch1", CVSTag.BRANCH);
+ IProject branchedProject = branchProject(project, root, branch);
+
+ // modify the branch
+ appendText(branchedProject.getFile("file1.txt"), "first line\n", true);
+ appendText(branchedProject.getFile("file2.txt"), "last line\n", false);
+ addResources(branchedProject, new String[] {"addition.txt"}, false);
+ deleteResources(branchedProject, new String[] {"delete.txt", "folder1/a.txt"}, false);
+ setContentsAndEnsureModified(branchedProject.getFile("folder1/b.txt"));
+ commitProject(branchedProject);
+
+ // modify local workspace
+ appendText(project.getFile("file1.txt"), "conflict line\n", true);
+ setContentsAndEnsureModified(project.getFile("folder1/a.txt"));
+ setContentsAndEnsureModified(project.getFile("delete.txt"));
+ addResources(project, new String[] {"addition.txt"}, false);
+ appendText(project.getFile("file2.txt"), "conflict line\n", false);
+
+ // create a merge subscriber
+ CVSMergeSubscriber subscriber = createMergeSubscriber(project, root, branch);
+
+ // check the sync states
+ assertSyncEquals("testMarkAsMergedConflicts", subscriber, project,
+ new String[] { "delete.txt", "file1.txt", "file2.txt", "addition.txt", "folder1/a.txt"},
+ true, new int[] {
+ SyncInfo.CONFLICTING | SyncInfo.CHANGE,
+ SyncInfo.CONFLICTING | SyncInfo.CHANGE,
+ SyncInfo.CONFLICTING | SyncInfo.CHANGE,
+ SyncInfo.CONFLICTING | SyncInfo.ADDITION,
+ SyncInfo.CONFLICTING | SyncInfo.CHANGE});
+
+ markAsMerged(subscriber, project, new String[] { "delete.txt", "file1.txt", "file2.txt", "addition.txt", "folder1/a.txt"});
+
+ // check the sync states
+ assertSyncEquals("testUnmergableConflicts", subscriber, project,
+ new String[] { "delete.txt", "file1.txt", "file2.txt", "addition.txt", "folder1/a.txt"},
+ true, new int[] {
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC,
+ SyncInfo.IN_SYNC});
+ }
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
index ef51ce85e..7b38af415 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
@@ -285,7 +285,6 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
private void update(SyncInfo[] infos, final boolean allowOverwrite) throws TeamException {
TestWorkspaceUpdateAction action = new TestWorkspaceUpdateAction(allowOverwrite);
- action.setSubscriber(getSubscriber());
try {
action.getRunnable(new SyncInfoSet(infos)).run(DEFAULT_MONITOR);
} catch (InvocationTargetException e) {
@@ -297,7 +296,6 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
private void commitResources(SyncInfo[] syncResources) throws TeamException {
TestCommitAction action = new TestCommitAction();
- action.setSubscriber(getSubscriber());
try {
action.getRunnable(new SyncInfoSet(syncResources)).run(DEFAULT_MONITOR);
} catch (InvocationTargetException e) {
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java
new file mode 100644
index 000000000..6b7af3ef6
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestMarkAsMergedAction.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.tests.ccvs.core.subscriber;
+
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberConfirmMergedAction;
+import org.eclipse.team.ui.sync.SyncInfoSet;
+
+
+class TestMarkAsMergedAction extends SubscriberConfirmMergedAction {
+ public IRunnableWithProgress getRunnable(SyncInfoSet syncSet) {
+ return super.getRunnable(syncSet);
+ }
+ protected boolean canRunAsJob() {
+ return false;
+ }
+} \ No newline at end of file

Back to the top