Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-03-06 14:41:17 -0500
committerMichael Valenta2002-03-06 14:41:17 -0500
commitf4ea6d02ff6d9ff9c812a275ccc5b800d6aee8f3 (patch)
tree0823fe745e14139473e2c02dc7760e95ed9d9ed2
parent335283507f5477b5375c4e2e9450e58d69c9b800 (diff)
downloadeclipse.platform.team-branch-9023.tar.gz
eclipse.platform.team-branch-9023.tar.xz
eclipse.platform.team-branch-9023.zip
10871: RemoveEntryHandler fails on delete+rename to deleted+releasebranch-9023
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractMessageCommand.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java42
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Remove.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Tag.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java27
9 files changed, 71 insertions, 14 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractMessageCommand.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractMessageCommand.java
index d9a59fc89..76fb00c8c 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractMessageCommand.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractMessageCommand.java
@@ -24,7 +24,7 @@ abstract class AbstractMessageCommand extends Command {
throws CVSException {
// Send all folders that are already managed to the server
- new FileStructureVisitor(session, false, false, monitor).visit(resources);
+ new FileStructureVisitor(session, false, false, monitor).visit(session, resources);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
index ce83ee69d..30d92d8aa 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
@@ -5,8 +5,11 @@ package org.eclipse.team.internal.ccvs.core.client;
* All Rights Reserved.
*/
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -157,11 +160,40 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor {
* This method is used to visit a set of ICVSResources. Using it ensures
* that a common parent between the set of resources is only sent once
*/
- public void visit(ICVSResource[] resources) throws CVSException {
+ public void visit(Session session, ICVSResource[] resources) throws CVSException {
+
+ // Sort the resources to avoid sending the same directory multiple times
+ List resourceList = new ArrayList(resources.length);
+ resourceList.addAll(Arrays.asList(resources));
+ final ICVSFolder localRoot = session.getLocalRoot();
+ Collections.sort(resourceList, new Comparator() {
+ public int compare(Object object1, Object object2) {
+ ICVSResource resource1 = (ICVSResource)object1;
+ ICVSResource resource2 = (ICVSResource)object2;
+ try {
+ String path1 = resource1.getParent().getRelativePath(localRoot);
+ String path2 = resource2.getParent().getRelativePath(localRoot);
+ int pathCompare = path1.compareTo(path2);
+ if (pathCompare == 0) {
+ if (resource1.isFolder() == resource2.isFolder()) {
+ return resource1.getName().compareTo(resource2.getName());
+ } else if (resource1.isFolder()) {
+ return 1;
+ } else {
+ return -1;
+ }
+ } else {
+ return pathCompare;
+ }
+ } catch (CVSException e) {
+ return resource1.getName().compareTo(resource2.getName());
+ }
+ }
+ });
// Visit all the resources
- for (int i = 0; i < resources.length; i++) {
- resources[i].accept(this);
+ for (int i = 0; i < resourceList.size(); i++) {
+ ((ICVSResource)resourceList.get(i)).accept(this);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java
index ea3808ae5..b353da0d2 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Add.java
@@ -43,7 +43,7 @@ public class Add extends Command {
// Get a vistor and use it on every resource we should
// work on
AddStructureVisitor visitor = new AddStructureVisitor(session, monitor);
- visitor.visit(resources);
+ visitor.visit(session, resources);
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
index 8736e9864..71e6bd402 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
@@ -283,7 +283,7 @@ public abstract class Command {
boolean emptyFolders, IProgressMonitor monitor) throws CVSException {
checkResourcesManaged(resources);
- new FileStructureVisitor(session, emptyFolders, true, monitor).visit(resources);
+ new FileStructureVisitor(session, emptyFolders, true, monitor).visit(session, resources);
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java
index e4010a351..fcc7e1257 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Commit.java
@@ -33,7 +33,7 @@ public class Commit extends Command {
// Send all changed files to the server
ModifiedFileSender visitor = new ModifiedFileSender(session, monitor);
- visitor.visit(resources);
+ visitor.visit(session, resources);
// Send the changed files as arguments
// XXX Is this the way the command line client works?
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
index f70030e61..db8f6f1cf 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Diff.java
@@ -50,6 +50,6 @@ public class Diff extends Command {
checkResourcesManaged(resources);
DiffStructureVisitor visitor = new DiffStructureVisitor(session, monitor);
- visitor.visit(resources);
+ visitor.visit(session, resources);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Remove.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Remove.java
index 7116b7e09..f679f2d86 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Remove.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Remove.java
@@ -25,7 +25,7 @@ public class Remove extends Command {
// Send all modified files to the server
// XXX Does the command line client send all modified files?
- new ModifiedFileSender(session, monitor).visit(resources);
+ new ModifiedFileSender(session, monitor).visit(session, resources);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Tag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Tag.java
index 96257a379..b17e354ec 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Tag.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Tag.java
@@ -84,9 +84,9 @@ public class Tag extends Command {
// Send all folders that are already managed to the server
if (customBehaviorEnabled) {
- new TagFileSender(session, monitor).visit(resources);
+ new TagFileSender(session, monitor).visit(session, resources);
} else {
- new FileStructureVisitor(session, false, false, monitor).visit(resources);
+ new FileStructureVisitor(session, false, false, monitor).visit(session, resources);
}
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java
index d0df28564..af34765fd 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/OrphanedFolderListener.java
@@ -57,11 +57,36 @@ public class OrphanedFolderListener extends ResourceDeltaVisitor {
}
/*
+ * Handle the case where an added file has the same name as a "cvs removed" file
+ * by restoring the sync info to what it was before the delete
+ */
+ private void handleReplacedDeletion(IResource resource) {
+ if (resource.getType() == IResource.FILE) {
+ try {
+ ICVSFile mFile = (ICVSFile)Session.getManagedResource(resource);
+ if (mFile.isManaged()) {
+ ResourceSyncInfo info = mFile.getSyncInfo();
+ if (info.isDeleted()) {
+ mFile.setSyncInfo(new ResourceSyncInfo(info.getName(), info.getRevision(), info.getTimeStamp(), info.getKeywordMode(), info.getTag(), info.getPermissions()));
+ }
+ CVSProviderPlugin.getSynchronizer().reload(resource.getLocation().toFile(), Policy.monitorFor(null));
+ }
+ } catch (CVSException e) {
+ CVSProviderPlugin.log(e);
+ }
+ }
+ }
+
+ /*
* @see ResourceDeltaVisitor#handleAdded(IResource[])
*/
protected void handleAdded(IResource[] resources) {
for (int i = 0; i < resources.length; i++) {
- handleOrphanedSubtree(resources[i]);
+ if (resources[i].getType() == IResource.FOLDER) {
+ handleOrphanedSubtree(resources[i]);
+ } else if (resources[i].getType() == IResource.FILE) {
+ handleReplacedDeletion(resources[i]);
+ }
}
}

Back to the top