Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-02-04 18:03:56 +0000
committerMichael Valenta2002-02-04 18:03:56 +0000
commit2b81a8e3ef94337913b863b8e1c553c1740dfd6f (patch)
tree153493848a4d8a71a6dff0bee67ae57236f013c6
parent18c1e6b4f1769021275039395b214742173f4d63 (diff)
downloadeclipse.platform.team-2b81a8e3ef94337913b863b8e1c553c1740dfd6f.tar.gz
eclipse.platform.team-2b81a8e3ef94337913b863b8e1c553c1740dfd6f.tar.xz
eclipse.platform.team-2b81a8e3ef94337913b863b8e1c553c1740dfd6f.zip
8996: Projects that contained empty directories are puned!
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java13
-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/Update.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java20
6 files changed, 35 insertions, 6 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
index 266fcc1cc..0eaeb55be 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Checkout.java
@@ -87,7 +87,7 @@ public class Checkout extends Command {
session.getLocalRoot().getFolder(dOption.argument) };
// Prune empty directories
- ICVSResourceVisitor visitor = new PruneFolderVisitor();
+ ICVSResourceVisitor visitor = new PruneFolderVisitor(session);
for (int i=0; i<resources.length; i++) {
resources[i].accept(visitor);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java
index 8c1494722..30b3635ee 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/PruneFolderVisitor.java
@@ -16,7 +16,12 @@ import org.eclipse.team.internal.ccvs.core.resources.ICVSResourceVisitor;
* recusion (the folders that do not have subfolders).
*/
class PruneFolderVisitor implements ICVSResourceVisitor {
-
+
+ private Session session;
+
+ public PruneFolderVisitor(Session s) {
+ session = s;
+ }
/**
* @see ICVSResourceVisitor#visitFile(IManagedFile)
*/
@@ -27,8 +32,12 @@ class PruneFolderVisitor implements ICVSResourceVisitor {
* @see ICVSResourceVisitor#visitFolder(ICVSFolder)
*/
public void visitFolder(ICVSFolder folder) throws CVSException {
+ // First prune any empty children
folder.acceptChildren(this);
- if (folder.getFiles().length == 0 &&
+ // Then prune the folder if it is not the command root.
+ // XXX Seems a bit inefficient to fetch the files and folders separately
+ if ( ! folder.equals(session.getLocalRoot()) &&
+ folder.getFiles().length == 0 &&
folder.getFolders().length == 0) {
folder.delete();
folder.unmanage();
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 4643d7093..980a4156a 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
@@ -23,8 +23,6 @@ public class Remove extends Command {
LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor)
throws CVSException {
- ICVSResource[] mWorkResources;
-
// Send all changed files to the server
sendFileStructure(session, resources, true, false, monitor);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java
index 11950b344..129dffebf 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java
@@ -69,7 +69,7 @@ public class Update extends Command {
if (PRUNE_EMPTY_DIRECTORIES.isElementOf(localOptions) ||
findOption(localOptions, "-D") != null) {
// Delete empty directories
- ICVSResourceVisitor visitor = new PruneFolderVisitor();
+ ICVSResourceVisitor visitor = new PruneFolderVisitor(session);
for (int i = 0; i < resources.length; i++) {
resources[i].accept(visitor);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index c35be2e18..9e1dc0294 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -332,6 +332,8 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
}
public void updateCache() throws CVSException {
+ if (passwordFixed)
+ return;
IUserAuthenticator authenticator = getAuthenticator();
if (authenticator != null) {
authenticator.cachePassword(this, this, password);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java
index b1cd63e41..f3d588b95 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/compatible/BasicTest.java
@@ -283,6 +283,26 @@ public class BasicTest extends JUnitTestCase {
}
+ public void testPrune2() throws Exception {
+
+ // Download content in two locations
+ env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},"");
+ env2.execute("co",EMPTY_ARGS,new String[]{"proj2"},"");
+
+ // change the file "proj1/folder1/c.txt" in env1 check it in
+ // on the server
+ env1.deleteFile("proj2/f1/b.txt");
+ env1.deleteFile("proj2/f1/c.txt");
+ env1.execute("remove",EMPTY_ARGS,new String[0],"proj2");
+
+ env1.execute("ci",new String[]{"-m","TestMessage"},new String[]{"proj2"},"");
+ env1.execute("update",new String[]{"-P"},new String[]{},"proj2");
+
+ // update env2 and make sure the changes are there
+ env2.execute("update",new String[]{"-P"},new String[]{},"proj2");
+
+ }
+
public void testAdmin() throws Exception {
env1.execute("co",EMPTY_ARGS,new String[]{"proj2"},"");

Back to the top