Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-01-31 21:44:02 +0000
committerMichael Valenta2002-01-31 21:44:02 +0000
commitf86f73e7c7533eb31235585b0df7ff1cfd4ceb8c (patch)
tree8833b2e36b19327be78b64e83035d8a4807aae15
parentc20869ccdccef5d0ec17614ca922dbe1978c6623 (diff)
downloadeclipse.platform.team-f86f73e7c7533eb31235585b0df7ff1cfd4ceb8c.tar.gz
eclipse.platform.team-f86f73e7c7533eb31235585b0df7ff1cfd4ceb8c.tar.xz
eclipse.platform.team-f86f73e7c7533eb31235585b0df7ff1cfd4ceb8c.zip
8493: Need to port code for fetching module definitions from CVS server
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java70
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java11
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java7
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java113
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java7
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchTag.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules9
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt1
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java74
19 files changed, 245 insertions, 106 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java
index 6bef6eca6..b69d0bf58 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFolder.java
@@ -1,32 +1,40 @@
-package org.eclipse.team.ccvs.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.core.TeamException;
-
- /**
- * This interface represents a remote folder in a repository. It provides
- * access to the members (remote files and folders) of a remote folder
- *
- * Clients are not expected to implement this interface.
- */
-public interface ICVSRemoteFolder extends ICVSRemoteResource {
-
- /**
- * Allows a client to change the context of a remote folder handle. For
- * example, if a remote folder was created with the HEAD context (e.g. can
- * be used to browse the main branch) use this method to change the
- * context to another branch tag or to a version tag.
- */
- public void setTag(CVSTag tagName);
-
- /**
- * Return the context of this handle. The returned tag can be a branch or
- * version tag.
- */
- public CVSTag getTag();
+package org.eclipse.team.ccvs.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
+
+ /**
+ * This interface represents a remote folder in a repository. It provides
+ * access to the members (remote files and folders) of a remote folder
+ *
+ * Clients are not expected to implement this interface.
+ */
+public interface ICVSRemoteFolder extends ICVSRemoteResource {
+
+ /**
+ * Allows a client to change the context of a remote folder handle. For
+ * example, if a remote folder was created with the HEAD context (e.g. can
+ * be used to browse the main branch) use this method to change the
+ * context to another branch tag or to a version tag.
+ */
+ public void setTag(CVSTag tagName);
+
+ /**
+ * Return the context of this handle. The returned tag can be a branch or
+ * version tag.
+ */
+ public CVSTag getTag();
+
+ /**
+ * Return the local options that are used to determine how memebers are retrieved.
+ *
+ * Interesting options are:
+ * Checkout.ALIAS
+ * Command.DO_NOT_RECURSE
+ */
+ public LocalOption[] getLocalOptions();
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java
index 928dc74e5..b02bf45ef 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation.java
@@ -58,9 +58,12 @@ public interface ICVSRepositoryLocation extends IAdaptable {
* Returns the immediate children of this location. If tag is <code>null</code> the
* HEAD branch is assumed.
*
+ * If modules is true, then the module definitions from the CVSROOT/modules file are returned.
+ * Otherwise, the root level projects are returned.
+ *
* @param tag the context in which to return the members (e.g. branch or version).
*/
- public ICVSRemoteResource[] members(CVSTag tag, IProgressMonitor progress) throws CVSException;
+ public ICVSRemoteResource[] members(CVSTag tag, boolean modules, IProgressMonitor progress) throws CVSException;
/**
* Returns a handle to a remote folder at this repository location using the given tag as the
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java
index d73854b1a..eae8be75a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/ImportStructureVisitor.java
@@ -11,6 +11,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.resources.ICVSFile;
import org.eclipse.team.internal.ccvs.core.resources.ICVSFolder;
+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.FileNameMatcher;
/**
@@ -103,8 +104,8 @@ class ImportStructureVisitor extends AbstractStructureVisitor {
} else {
mode = "";
}
- sendFile(mFile,false,mode);
-
+ boolean binary = mode != null && mode.indexOf(ResourceSyncInfo.BINARY_TAG) != -1;
+ session.sendModified(mFile, binary, monitor);
}
/**
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 f8bd933e1..4579c8930 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
@@ -34,6 +34,7 @@ import org.eclipse.team.internal.ccvs.core.CVSProvider;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
+import org.eclipse.team.internal.ccvs.core.resources.RemoteModule;
/**
* This class manages a CVS repository location.
@@ -179,10 +180,14 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
/*
* @see ICVSRepositoryLocation#getRemoteFolder(IPath, String)
*/
- public ICVSRemoteResource[] members(CVSTag tag, IProgressMonitor progress) throws CVSException {
+ public ICVSRemoteResource[] members(CVSTag tag, boolean modules, IProgressMonitor progress) throws CVSException {
try {
- RemoteFolder root = new RemoteFolder(null, this, Path.EMPTY, tag);
- return (ICVSRemoteResource[])root.members(progress);
+ if (modules) {
+ return RemoteModule.getRemoteModules(this, tag, progress);
+ } else {
+ RemoteFolder root = new RemoteFolder(null, this, Path.EMPTY, tag);
+ return (ICVSRemoteResource[])root.members(progress);
+ }
} catch(TeamException e) {
throw new CVSException(e.getStatus());
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
index 74d64de49..dcc6a6620 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java
@@ -94,11 +94,8 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, ICVSFi
}
public RemoteFile(RemoteFolder parent, String name, String revision, CVSTag tag) {
- this(parent, new ResourceSyncInfo(name, revision, "dummy", CVSProvider.isText(name)?"":"-kb", tag, "u=rw,g=rw,o=rw"));
- // XXX the keyword type of this remote file must be set correctly or else the
- // getContents may mangle the file.
- // XXX Will leaving the keyword mode blank result in the proper behavior when getting the contents
- // of a binary file?
+ this(parent, new ResourceSyncInfo(name, revision, "dummy", "", tag, "u=rw,g=rw,o=rw"));
+ // A blank keyword mode will use the type provided by the server to transfer the file contents
}
public RemoteFile(RemoteFolder parent, ResourceSyncInfo info) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
index d6e5cde1a..6e26d33cb 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
@@ -354,6 +354,10 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
}
+ public LocalOption[] getLocalOptions() {
+ return Command.NO_LOCAL_OPTIONS;
+ }
+
protected String getLocalPath() {
throw new UnsupportedOperationException();
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
index 2bc7a9989..ed6f0d38d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
@@ -6,21 +6,24 @@ package org.eclipse.team.internal.ccvs.core.resources;
*/
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.ccvs.core.CVSTag;
import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.client.Checkout;
+import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
@@ -33,17 +36,34 @@ public class RemoteModule extends RemoteFolder {
public static final String VIRTUAL_DIRECTORY = "CVSROOT/Emptydir";
private String label;
- private RemoteModule[] referencedModules;
- private LocalOption[] localOption;
+ private ICVSRemoteResource[] referencedModules;
+ private LocalOption[] localOptions;
+
+ public static RemoteModule[] getRemoteModules(ICVSRepositoryLocation repository, CVSTag tag, IProgressMonitor monitor) throws TeamException {
+
+ RemoteModule[] modules;
+ Session s = new Session(repository, (ICVSFolder)Session.getManagedResource(ResourcesPlugin.getWorkspace().getRoot()), false);
+ s.open(monitor);
+ try {
+ modules = Command.CHECKOUT.getRemoteModules(s, tag, monitor);
+ } finally {
+ s.close();
+ }
+
+ return modules;
+ }
/**
* Create a set of RemoteModules from the provided module definition strings returned from the server
*
+ * At the moment, we are very restrictive on the types of modules we support.
*/
public static RemoteModule[] createRemoteModules(String[] moduleDefinitionStrings, ICVSRepositoryLocation repository, CVSTag tag) {
Map modules = new HashMap();
Map referencedModulesTable = new HashMap();
+ Map moduleAliases = new HashMap();
+ List acceptableModules = new ArrayList();
// First pass: Create the remote module instances based on remote mapping
for (int i = 0; i < moduleDefinitionStrings.length; i++) {
@@ -95,8 +115,9 @@ public class RemoteModule extends RemoteFolder {
while (tokenizer.hasMoreTokens())
expansions.add(tokenizer.nextToken());
- // XXX Need to create a remote module representing the alias!!!
-
+ moduleAliases.put(moduleName, (String[]) expansions.toArray(new String[expansions.size()]));
+ modules.put(moduleName, new RemoteModule(moduleName, null, null, repository, null, localOptions, tag, true));
+
} else {
// The module definition must have a leading directory which can be followed by some files
@@ -108,7 +129,7 @@ public class RemoteModule extends RemoteFolder {
if ((next.charAt(0) != '&'))
files.add(next);
}
- RemoteModule remoteModule = new RemoteModule(moduleName, null, localName, repository, new Path(directory), tag, ! files.isEmpty());
+ RemoteModule remoteModule = new RemoteModule(moduleName, null, localName, repository, new Path(directory), localOptions, tag, ! files.isEmpty());
modules.put(moduleName, remoteModule);
if ( ! files.isEmpty()) {
ICVSRemoteResource[] children = new ICVSRemoteResource[files.size()];
@@ -118,7 +139,7 @@ public class RemoteModule extends RemoteFolder {
}
}
} else {
- modules.put(moduleName, new RemoteModule(moduleName, null, localName, repository, null, tag, true));
+ modules.put(moduleName, new RemoteModule(moduleName, null, localName, repository, null, localOptions, tag, true));
}
// Record any referenced modules so that can be cross-referenced below
@@ -132,34 +153,84 @@ public class RemoteModule extends RemoteFolder {
}
}
- // Second pass: Cross reference remote modules where necessary
- Iterator iter = modules.keySet().iterator();
+ // Second pass: Cross reference aliases to modules
+ // XXX Aliases can reference other aliases which confuses the expansion!
+ Iterator iter = moduleAliases.keySet().iterator();
+ while (iter.hasNext()) {
+ String moduleName = (String)iter.next();
+ RemoteModule module = (RemoteModule)modules.get(moduleName);
+ String[] expansion = (String[])moduleAliases.get(moduleName);
+ List referencedFolders = new ArrayList();
+ boolean acceptable = true;
+ for (int i = 0; i < expansion.length; i++) {
+ if (expansion[i].charAt(0) == '!') {
+ // XXX Unsupported for now
+ acceptable = false;
+ } else {
+ IPath path = new Path(expansion[i]);
+ if (path.segmentCount() > 1) {
+ // XXX Unsupported for now
+ acceptable = false;
+ } else {
+ RemoteModule child = (RemoteModule)modules.get(expansion[i]);
+ if (child == null) {
+ referencedFolders.add(new RemoteFolder(null, repository, path, tag));
+ } else {
+ acceptable = false;
+ // Need to check if the child is a module alias
+// if (child.isAlias()) {
+// // XXX Unsupported for now
+// } else {
+// referencedFolders.add(child);
+// }
+ }
+ }
+ }
+ }
+ module.setChildren((ICVSRemoteResource[]) referencedFolders.toArray(new ICVSRemoteResource[referencedFolders.size()]));
+ if (acceptable)
+ acceptableModules.add(module);
+ }
+
+ // Third pass: Cross reference remote modules where necessary
+ iter = modules.keySet().iterator();
while (iter.hasNext()) {
String moduleName = (String)iter.next();
String[] children = (String[])referencedModulesTable.get(moduleName);
if (children != null) {
RemoteModule module = (RemoteModule)modules.get(moduleName);
- RemoteModule[] referencedModules = new RemoteModule[children.length];
- for (int i = 0; i < referencedModules.length; i++) {
- referencedModules[i] = (RemoteModule)modules.get(children[i]);
+ List referencedFolders = new ArrayList();
+ for (int i = 0; i < children.length; i++) {
+ RemoteModule child = (RemoteModule)modules.get(children[i].substring(1));
+ if (child.isAlias()) {
+ // Include alias children in-line
+ referencedFolders.addAll(Arrays.asList(child.getChildren()));
+ } else {
+ referencedFolders.add(child);
+ }
}
- module.setReferencedModules(referencedModules);
+ module.setReferencedModules((ICVSRemoteResource[]) referencedFolders.toArray(new ICVSRemoteResource[referencedFolders.size()]));
}
}
- return (RemoteModule[])modules.values().toArray(new RemoteModule[modules.size()]);
+ // return (RemoteModule[])modules.values().toArray(new RemoteModule[modules.size()]);
+ return (RemoteModule[])acceptableModules.toArray(new RemoteModule[acceptableModules.size()]);
}
- public RemoteModule(String label, RemoteFolder parent, String localName, ICVSRepositoryLocation repository, IPath repositoryRelativePath, CVSTag tag, boolean isStatic) {
+ public RemoteModule(String label, RemoteFolder parent, String localName, ICVSRepositoryLocation repository, IPath repositoryRelativePath, LocalOption[] localOptions, CVSTag tag, boolean isStatic) {
super(parent,
localName == null ? label : localName,
repository,
repositoryRelativePath == null ? new Path(VIRTUAL_DIRECTORY) : repositoryRelativePath,
tag,
isStatic);
+ this.localOptions = localOptions;
this.label = label;
}
+ public LocalOption[] getLocalOptions() {
+ return localOptions;
+ }
/*
* Override of inherited getMembers in order to combine the physical members with any referenced modules
*/
@@ -177,6 +248,12 @@ public class RemoteModule extends RemoteFolder {
} else {
// Combine two sets of children
allChildren = new ICVSRemoteResource[physicalChildren.length + referencedModules.length];
+ for (int i = 0; i < physicalChildren.length; i++) {
+ allChildren[i] = physicalChildren[i];
+ }
+ for (int i = 0; i < referencedModules.length; i++) {
+ allChildren[i + physicalChildren.length] = referencedModules[i];
+ }
}
} else if (physicalChildren != null) {
allChildren = physicalChildren;
@@ -195,8 +272,12 @@ public class RemoteModule extends RemoteFolder {
this.folderInfo = new FolderSyncInfo(folderInfo.getRepository(), folderInfo.getRoot(), folderInfo.getTag(), true);
}
- private void setReferencedModules(RemoteModule[] referencedModules) {
+ private void setReferencedModules(ICVSRemoteResource[] referencedModules) {
this.referencedModules = referencedModules;
}
+ public boolean isAlias() {
+ return Checkout.ALIAS.isElementOf(localOptions);
+ }
+
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
index 9f85e13d4..c05525231 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
@@ -43,6 +43,7 @@ public class CVSPreferencesPage
private Button pruneEmptyDirectoriesField;
private Text timeoutValue;
private Combo quietnessCombo;
+ private Button showModulesField;
/**
* Utility method that creates a combo box
@@ -131,6 +132,11 @@ public class CVSPreferencesPage
createLabel(composite, Policy.bind("CVSPreferencePage.quietness"));
quietnessCombo = createCombo(composite);
+ showModulesField =
+ createCheckBox(
+ composite,
+ Policy.bind("CVSPreferencePage.showModules"));
+
initializeValues();
return composite;
@@ -176,6 +182,8 @@ public class CVSPreferencesPage
quietnessCombo.add(Policy.bind("CVSPreferencePage.somewhatquiet"));
quietnessCombo.add(Policy.bind("CVSPreferencePage.reallyquiet"));
quietnessCombo.select(store.getInt(ICVSUIConstants.PREF_QUIETNESS));
+ showModulesField.setSelection(
+ store.getBoolean(ICVSUIConstants.PREF_SHOW_MODULES));
}
/**
@@ -196,6 +204,11 @@ public class CVSPreferencesPage
IPreferenceStore store = getPreferenceStore();
+ boolean refreshRequired = false;
+ if (store.getBoolean(ICVSUIConstants.PREF_SHOW_MODULES) != showModulesField.getSelection()) {
+ refreshRequired = true;
+ }
+
store.setValue(
ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES,
pruneEmptyDirectoriesField.getSelection());
@@ -205,6 +218,9 @@ public class CVSPreferencesPage
store.setValue(
ICVSUIConstants.PREF_QUIETNESS,
quietnessCombo.getSelectionIndex());
+ store.setValue(
+ ICVSUIConstants.PREF_SHOW_MODULES,
+ showModulesField.getSelection());
CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(
store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
@@ -212,7 +228,11 @@ public class CVSPreferencesPage
store.getInt(ICVSUIConstants.PREF_TIMEOUT));
CVSProviderPlugin.getPlugin().setQuietness(
getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
-
+
+ if (refreshRequired) {
+ RepositoriesView.refreshAll();
+ }
+
return true;
}
@@ -227,6 +247,8 @@ public class CVSPreferencesPage
store.getDefaultBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
timeoutValue.setText(new Integer(store.getDefaultInt(ICVSUIConstants.PREF_TIMEOUT)).toString());
quietnessCombo.select(store.getDefaultInt(ICVSUIConstants.PREF_QUIETNESS));
+ showModulesField.setSelection(
+ store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_MODULES));
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index 4f5661375..d68fceec0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -153,6 +153,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
store.setDefault(ICVSUIConstants.PREF_SHOW_COMMENTS, true);
store.setDefault(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES, CVSProviderPlugin.DEFAULT_PRUNE);
store.setDefault(ICVSUIConstants.PREF_TIMEOUT, CVSProviderPlugin.DEFAULT_TIMEOUT);
+ store.setDefault(ICVSUIConstants.PREF_SHOW_MODULES, false);
store.setDefault(ICVSUIConstants.PREF_FILETEXT_DECORATION, CVSDecoratorConfiguration.DEFAULT_FILETEXTFORMAT);
store.setDefault(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION, CVSDecoratorConfiguration.DEFAULT_FOLDERTEXTFORMAT);
@@ -174,6 +175,9 @@ public class CVSUIPlugin extends AbstractUIPlugin {
CVSProviderPlugin.getPlugin().setQuietness(CVSPreferencesPage.getQuietnessOptionFor(store.getInt(ICVSUIConstants.PREF_QUIETNESS)));
}
+ public boolean isModulesEnabled() {
+ return getPreferenceStore().getBoolean(ICVSUIConstants.PREF_SHOW_MODULES);
+ }
/**
* @see Plugin#startup()
*/
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index df323428b..8d18fcf00 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -31,6 +31,7 @@ public interface ICVSUIConstants {
public final String PREF_PRUNE_EMPTY_DIRECTORIES = "pref_prune_empty_directories";
public final String PREF_TIMEOUT = "pref_timeout";
public final String PREF_QUIETNESS = "pref_quietness";
+ public final String PREF_SHOW_MODULES = "pref_show_modules";
// decorator preferences
public final String PREF_FILETEXT_DECORATION = "pref_filetext_decoration";
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java
index 07004d845..1d272a38e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java
@@ -20,6 +20,7 @@ import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.client.Checkout;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -41,14 +42,16 @@ public class AddToWorkspaceAction extends TeamAction {
while (elements.hasNext()) {
Object next = elements.next();
if (next instanceof ICVSRemoteFolder) {
- resources.add(next);
+ if ( ! Checkout.ALIAS.isElementOf(((ICVSRemoteFolder)next).getLocalOptions()))
+ resources.add(next);
continue;
}
if (next instanceof IAdaptable) {
IAdaptable a = (IAdaptable) next;
Object adapter = a.getAdapter(ICVSRemoteFolder.class);
if (adapter instanceof ICVSRemoteFolder) {
- resources.add(adapter);
+ if ( ! Checkout.ALIAS.isElementOf(((ICVSRemoteFolder)adapter).getLocalOptions()))
+ resources.add(adapter);
continue;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
index 8d0e2c99f..98db1d91d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
@@ -21,6 +21,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.client.Checkout;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -42,14 +43,16 @@ public class CheckoutAsAction extends TeamAction {
while (elements.hasNext()) {
Object next = elements.next();
if (next instanceof ICVSRemoteFolder) {
- resources.add(next);
+ if ( ! Checkout.ALIAS.isElementOf(((ICVSRemoteFolder)next).getLocalOptions()))
+ resources.add(next);
continue;
}
if (next instanceof IAdaptable) {
IAdaptable a = (IAdaptable) next;
Object adapter = a.getAdapter(ICVSRemoteFolder.class);
if (adapter instanceof ICVSRemoteFolder) {
- resources.add(adapter);
+ if ( ! Checkout.ALIAS.isElementOf(((ICVSRemoteFolder)adapter).getLocalOptions()))
+ resources.add(adapter);
continue;
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index b20dd8f25..9d9d1677f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -99,6 +99,7 @@ CVSPreferencePage.quietness=&Quietness level
CVSPreferencePage.notquiet=Verbose
CVSPreferencePage.somewhatquiet=Somewhat quiet
CVSPreferencePage.reallyquiet=Very quiet
+CVSPreferencePage.showModules=&Show modules from CVSROOT/modules in repository view
CheckoutAsAction.checkout=Checkout
CheckoutAsAction.enterProjectTitle=Enter Project Name
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchTag.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchTag.java
index 464d336a4..5271bf9fe 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchTag.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/BranchTag.java
@@ -56,7 +56,7 @@ public class BranchTag extends CVSModelElement implements IAdaptable {
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
try {
- result[0] = root.members(tag, new NullProgressMonitor());
+ result[0] = root.members(tag, CVSUIPlugin.getPlugin().isModulesEnabled(), new NullProgressMonitor());
} catch (TeamException e) {
handle(e);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
index 8104cd1a5..0024cd86a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/VersionCategory.java
@@ -51,7 +51,7 @@ public class VersionCategory extends CVSModelElement implements IAdaptable {
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
try {
- ICVSRemoteResource[] resources = repository.members(CVSTag.DEFAULT, new NullProgressMonitor());
+ ICVSRemoteResource[] resources = repository.members(CVSTag.DEFAULT, CVSUIPlugin.getPlugin().isModulesEnabled(), new NullProgressMonitor());
Object[] modules = new Object[resources.length];
for (int i = 0; i < resources.length; i++) {
modules[i] = new RemoteModule((ICVSRemoteFolder)resources[i], VersionCategory.this);
diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules
index 73fb4a45c..1daac9387 100644
--- a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules
+++ b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/CVSROOT/modules
@@ -26,8 +26,8 @@
# spread out over the entire source repository.
# Block access to CVS hogs
-world -a denied___checkout_of_world_takes_too_long
-. -a denied___checkout_of_world_takes_too_long
+#world -a denied___checkout_of_world_takes_too_long
+#. -a denied___checkout_of_world_takes_too_long
# self referencing modules
project1 project1
@@ -59,4 +59,7 @@ project6 &project6-dirA &project6-dirB
# using aliases to provide packaging
project7-common -a project7/common
project7-pc -a project7-common project7/pc
-project7-linux -a project7-common project7/linux \ No newline at end of file
+project7-linux -a project7-common project7/linux
+
+# simple use of module alias
+project8-alias -a project8 common \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt
new file mode 100644
index 000000000..e9257ebb5
--- /dev/null
+++ b/tests/org.eclipse.team.tests.cvs.core/resources/CommandTest/project8/file-p8.txt
@@ -0,0 +1 @@
+This is a file in project8 \ No newline at end of file
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
index c52419632..88268b00c 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
@@ -226,8 +226,6 @@ public class EclipseTest extends EclipseWorkspaceTest {
protected IProject checkoutProject(IProject project, String moduleName, CVSTag tag) throws TeamException {
if (project == null)
project = getWorkspace().getRoot().getProject(moduleName);
- if (moduleName == null)
- moduleName = project.getName();
CVSProviderPlugin.getProvider().checkout(getRepository(), project, moduleName, tag, DEFAULT_MONITOR);
return project;
}
@@ -355,7 +353,7 @@ public class EclipseTest extends EclipseWorkspaceTest {
if (resource1.isContainer())
assertEquals((RemoteFolder)resource1, (RemoteFolder)resource2, includeTags);
else
- assertEquals("File comparison failed", (ICVSFile)resource1, (ICVSFile)resource2, true, includeTags);
+ assertEquals("File comparison failed", (ICVSFile)resource1, (ICVSFile)resource2, false, includeTags);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
index a321f651b..00dee25d1 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
@@ -47,7 +47,7 @@ public class ModuleTest extends EclipseTest {
public static Test suite() {
TestSuite suite = new TestSuite(ModuleTest.class);
//return new CVSTestSetup(suite);
- return new CVSTestSetup(new ModuleTest("testSelfReferencingModule"));
+ return new CVSTestSetup(new ModuleTest("testSimpleAlias"));
}
private static boolean isSetUp = false;
@@ -80,7 +80,7 @@ public class ModuleTest extends EclipseTest {
uploadProject("common");
- remoteModules = getRemoteModules();
+ remoteModules = RemoteModule.getRemoteModules(getRepository(), null, DEFAULT_MONITOR);
isSetUp = true;
}
@@ -110,13 +110,16 @@ public class ModuleTest extends EclipseTest {
}
}
- // Commit the project on checkout to ensure that the .vcm_meta is created
- // XXX Temporary measure!!!
- protected IProject checkoutProject(IProject project, String moduleName, CVSTag tag) throws TeamException {
- project = super.checkoutProject(project, moduleName, tag);
- getProvider(project).add(new IResource[] {project.getFile(".vcm_meta")}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
- waitMsec(1000);
- commitProject(project);
+ // XXX Temporary method of checkout (i.e. with vcm_meta
+ protected IProject checkoutProject(String projectName, CVSTag tag) throws TeamException {
+ IProject project = super.checkoutProject(getWorkspace().getRoot().getProject(projectName), null, tag);
+ ICVSFolder parent = (ICVSFolder)Session.getManagedResource(project);
+ ICVSResource vcmmeta = Session.getManagedResource(project.getFile(".vcm_meta"));
+ if ( ! vcmmeta.isManaged() && ! parent.getFolderSyncInfo().getIsStatic()) {
+ getProvider(project).add(new IResource[] {project.getFile(".vcm_meta")}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ waitMsec(1000);
+ commitProject(project);
+ }
return project;
}
@@ -139,7 +142,7 @@ public class ModuleTest extends EclipseTest {
*/
public void testSelfReferencingModule() throws TeamException, CoreException, IOException {
uploadProject("project1");
- IProject project1 = checkoutProject(null, "project1", null);
+ IProject project1 = checkoutProject("project1", null);
IRemoteSyncElement tree = getProvider(project1).getRemoteSyncTree(project1, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertEquals("Local does not match remote", Session.getManagedResource(project1), (ICVSResource)tree.getRemote(), false, false);
RemoteModule module = getRemoteModule("project1");
@@ -155,18 +158,17 @@ public class ModuleTest extends EclipseTest {
*/
public void testFlattenedStructure() throws TeamException, CoreException, IOException {
- IProject docs = checkoutProject(null, "docs", null);
+ IProject docs = checkoutProject("docs", null);
IRemoteSyncElement tree = getProvider(docs).getRemoteSyncTree(docs, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertEquals("Local does not match remote", Session.getManagedResource(docs), (ICVSResource)tree.getRemote(), false, false);
RemoteModule module = getRemoteModule("docs");
- assertEquals("Local does not match module", Session.getManagedResource(docs), module, false, false);
-
+ assertEquals((RemoteFolder)tree.getRemote(), module, false);
- IProject macros = checkoutProject(null, "macros", null);
+ IProject macros = checkoutProject("macros", null);
tree = getProvider(macros).getRemoteSyncTree(macros, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertEquals("Local does not match remote", Session.getManagedResource(macros), (ICVSResource)tree.getRemote(), false, false);
module = getRemoteModule("macros");
- assertEquals("Local does not match module", Session.getManagedResource(macros), module, false, false);
+ assertEquals((RemoteFolder)tree.getRemote(), module, false);
}
@@ -180,19 +182,19 @@ public class ModuleTest extends EclipseTest {
*/
public void testIncludeAndExcludeDocs() throws TeamException, CoreException, IOException {
uploadProject("project2");
- IProject project2 = checkoutProject(null, "project2", null);
+ IProject project2 = checkoutProject("project2", null);
IRemoteSyncElement tree = getProvider(project2).getRemoteSyncTree(project2, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertEquals("Local does not match remote", Session.getManagedResource(project2), (ICVSResource)tree.getRemote(), false, false);
RemoteModule module = getRemoteModule("project2");
- assertEquals("Local does not match module", Session.getManagedResource(project2), module, false, false);
+ assertEquals((RemoteFolder)tree.getRemote(), module, false);
- project2 = checkoutProject(null, "project2-only", null);
+ project2 = checkoutProject("project2-only", null);
tree = getProvider(project2).getRemoteSyncTree(project2, CVSTag.DEFAULT, DEFAULT_MONITOR);
assertEquals("Local does not match remote", Session.getManagedResource(project2), (ICVSResource)tree.getRemote(), false, false);
module = getRemoteModule("project2-only");
- assertEquals("Local does not match module", Session.getManagedResource(project2), module, false, false);
+ assertEquals((RemoteFolder)tree.getRemote(), module, false);
}
@@ -206,15 +208,15 @@ public class ModuleTest extends EclipseTest {
*/
public void testAliasForFiles() throws TeamException, CoreException, IOException {
uploadProject("project3");
- IProject project3 = checkoutProject(null, "project3-sub", null);
+ IProject project3 = checkoutProject("project3-sub", null);
IRemoteSyncElement tree = getProvider(project3).getRemoteSyncTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project3), (ICVSResource)tree.getRemote(), false, false);
- project3 = checkoutProject(null, "project3-src", null);
+ project3 = checkoutProject("project3-src", null);
tree = getProvider(project3).getRemoteSyncTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project3), (ICVSResource)tree.getRemote(), false, false);
- project3 = checkoutProject(null, "project3-src_file", null);
+ project3 = checkoutProject("project3-src_file", null);
tree = getProvider(project3).getRemoteSyncTree(project3, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project3), (ICVSResource)tree.getRemote(), false, false);
}
@@ -229,31 +231,33 @@ public class ModuleTest extends EclipseTest {
*/
public void testAliases() throws TeamException, CoreException, IOException {
uploadProject("project7");
- IProject project7 = checkoutProject(null, "project7-common", null);
+ IProject project7 = checkoutProject("project7-common", null);
IRemoteSyncElement tree = getProvider(project7).getRemoteSyncTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project7), (ICVSResource)tree.getRemote(), false, false);
- project7 = checkoutProject(null, "project7-pc", null);
+ project7 = checkoutProject("project7-pc", null);
tree = getProvider(project7).getRemoteSyncTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project7), (ICVSResource)tree.getRemote(), false, false);
- project7 = checkoutProject(null, "project7-linux", null);
+ project7 = checkoutProject("project7-linux", null);
tree = getProvider(project7).getRemoteSyncTree(project7, CVSTag.DEFAULT, DEFAULT_MONITOR);
// assertEquals("Local does not match remote", Session.getManagedResource(project7), (ICVSResource)tree.getRemote(), false, false);
}
- public RemoteModule[] getRemoteModules() throws TeamException {
+
+ /*
+ * Test the following definition
+ *
+ * # simple use of module alias
+ * project8-alias -a project8 common
+ */
+ public void testSimpleAlias() throws TeamException, CoreException, IOException {
+ uploadProject("project8");
- RemoteModule[] modules;
- Session s = new Session(getRepository(), (ICVSFolder)Session.getManagedResource(ResourcesPlugin.getWorkspace().getRoot()));
- s.open(DEFAULT_MONITOR);
- try {
- modules = Command.CHECKOUT.getRemoteModules(s, null, DEFAULT_MONITOR);
- } finally {
- s.close();
- }
+ // XXX Module checkout will not work yet
+ // IProject project8 = checkoutProject("project8-alias", null);
- return modules;
+ RemoteModule module = getRemoteModule("project8-alias");
}
public RemoteModule getRemoteModule(String moduleName) {

Back to the top