Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2009-01-05 07:12:00 -0500
committerTomasz Zarna2009-01-05 07:12:00 -0500
commitac993eb502d9bddd05966f093aac93d29288957d (patch)
treee0e16584e78a1883abb3d8c44306b653fbaba614
parent7428adc7d55471605350abf376fd92b6cee5e529 (diff)
downloadeclipse.platform.team-R3_4_1_maintenance_patches.tar.gz
eclipse.platform.team-R3_4_1_maintenance_patches.tar.xz
eclipse.platform.team-R3_4_1_maintenance_patches.zip
bug 244425: Using mixed tags causes synchronization failureR3_4_1_maintenance_patches
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java8
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java93
2 files changed, 93 insertions, 8 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
index a2735beca..6fb3a53f7 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -322,12 +322,16 @@ public class RemoteFolderTreeBuilder {
if (d.getRevision() == DELETED) {
return null;
}
+ CVSTag newTag = tagForRemoteFolder(remoteRoot, tag);
+ if (newTag == null && file.getSyncInfo() != null) {
+ newTag = file.getSyncInfo().getTag();
+ }
remoteFile = new RemoteFile(remoteRoot,
d.getSyncState(),
file.getName(),
null, /* the revision will be retrieved from the server */
getKeywordMode(file), /* use the same keyword mode a the local file */
- tagForRemoteFolder(remoteRoot, tag));
+ newTag);
}
// Add the resource to its parent
remoteRoot.setChildren(new ICVSRemoteResource[] {remoteFile});
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
index e40adefd4..9580fd0ba 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,15 +15,30 @@ import java.lang.reflect.InvocationTargetException;
import junit.framework.Test;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.variants.CachedResourceVariant;
import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.resources.*;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.ICVSFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.internal.ccvs.core.ILogEntry;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
+import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTree;
+import org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTreeBuilder;
import org.eclipse.team.internal.ccvs.ui.operations.CheckoutToRemoteFolderOperation;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
import org.eclipse.team.tests.ccvs.core.EclipseTest;
@@ -282,7 +297,7 @@ public class RemoteResourceTest extends EclipseTest {
IProject project = createProject("testExists", new String[] { "file1.txt", "folder1/", "folder1/a.txt", "folder2/", "folder2/a.txt", "folder2/folder3/", "folder2/folder3/b.txt", "folder2/folder3/c.txt"});
ICVSRemoteResource resource1 = CVSWorkspaceRoot.getRemoteResourceFor(project.getFile("file1.txt"));
assertTrue(resource1.exists(DEFAULT_MONITOR));
- ICVSRemoteResource resource2 = (ICVSRemoteFolder)CVSWorkspaceRoot.getRemoteResourceFor(project.getFolder("folder2/folder3/"));
+ ICVSRemoteResource resource2 = CVSWorkspaceRoot.getRemoteResourceFor(project.getFolder("folder2/folder3/"));
assertTrue(resource2.exists(DEFAULT_MONITOR));
deleteResources(project, new String[] {"file1.txt", "folder2/folder3/b.txt", "folder2/folder3/c.txt" }, true);
assertTrue( ! resource1.exists(DEFAULT_MONITOR));
@@ -328,6 +343,72 @@ public class RemoteResourceTest extends EclipseTest {
remote = checkoutRemote(remote);
assertEquals(Path.EMPTY, CVSWorkspaceRoot.getCVSResourceFor(copy), remote, false, true);
}
+
+ public void testBug244425() throws CVSException, CoreException,
+ IOException {
+ IProject projectHead = createProject("test", new String[] { "a/",
+ "a/file1.txt", "a/file2.txt" });
+ appendText(projectHead.getFile("a/file1.txt"), "dummy", true);
+ appendText(projectHead.getFile("a/file2.txt"), "dummy", true);
+ commitNewProject(projectHead);
+
+ // Checkout and branch a copy
+ CVSTag root = new CVSTag("root_branch1", CVSTag.VERSION);
+ CVSTag branch = new CVSTag("branch1", CVSTag.BRANCH);
+ IProject projectBranch = checkoutCopy(projectHead, "branch");
+ tagProject(projectHead, root, false);
+ tagProject(projectHead, branch, false);
+ updateProject(projectBranch, branch, false);
+
+ // replace the file in original project with a branched one
+ replace(new IResource[] { projectHead.getFile("a/file2.txt") }, branch,
+ true);
+
+ // modify the file on branch
+ appendText(projectBranch.getFile("a/file2.txt"), "dummy2", true);
+ commitProject(projectBranch);
+
+ // check the file from HEAD
+ ICVSRemoteResource file1 = getRemoteTree(projectHead
+ .getFile("a/file1.txt"), null, DEFAULT_MONITOR);
+ assertEquals(null, file1.getSyncInfo().getTag());
+ assertEquals("1.2", file1.getSyncInfo().getRevision());
+
+ // we want to be sure that the tree notices that the file is from
+ // a different branch
+ ICVSRemoteResource file2 = getRemoteTree(projectHead
+ .getFile("a/file2.txt"), null, DEFAULT_MONITOR);
+ assertEquals(branch, file2.getSyncInfo().getTag());
+ assertEquals("1.2.2.1", file2.getSyncInfo().getRevision());
+ }
+
+ public void testBug244425_compare() throws CVSException, CoreException,
+ IOException {
+ IProject projectHead = createProject("test", new String[] { "a/",
+ "a/file1.txt", "a/file2.txt" });
+ appendText(projectHead.getFile("a/file1.txt"), "dummy", true);
+ appendText(projectHead.getFile("a/file2.txt"), "dummy", true);
+ // tag files
+ CVSTag tag = new CVSTag("testtag", CVSTag.VERSION);
+ tagProject(projectHead, tag, false);
+
+ // modify files
+ appendText(projectHead.getFile("a/file2.txt"), "dummy2", true);
+ commitProject(projectHead);
+
+ // revert to tagged version
+ replace(new IResource[] { projectHead.getFile("a/file2.txt") }, tag,
+ true);
+ assertEquals("1.1", CVSWorkspaceRoot.getCVSFileFor(
+ projectHead.getFile("a/file2.txt")).getSyncInfo().getRevision());
+
+ // compare with head
+ // this is the crucial part of this test. It is necessary that
+ // getRemoteTree ignores existing tag when comparing with f.e. HEAD.
+ ICVSRemoteResource remoteFile = getRemoteTree(projectHead
+ .getFile("a/file2.txt"), new CVSTag() /* HEAD */, DEFAULT_MONITOR);
+ assertEquals("1.2", remoteFile.getSyncInfo().getRevision());
+ }
private ICVSRemoteFolder checkoutRemote(ICVSRemoteFolder remote) throws CVSException, InvocationTargetException, InterruptedException {
return CheckoutToRemoteFolderOperation.checkoutRemoteFolder(null, remote, DEFAULT_MONITOR);

Back to the top