Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java54
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java26
4 files changed, 44 insertions, 38 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
index 98fdd3dba..aee784f3b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
@@ -324,3 +324,4 @@ CRLFDetectInputStream.0=CVS file {0} either contains invalid line endings on the
SynchronizerSyncInfoCache.0=Synchronization information could not be cached for {0}. The only negative effect of this may be decreased performance.
DeferredResourceChangeHandler.0=Reconciling CVS state changes
DeferredResourceChangeHandler.1=Errors occured handling ignore file (.cvsignore) changes. Some resources may not be decorated properly.
+CVSWorkspaceRoot.11=The parent folder of managed file {0} does not have sync info associated with it.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
index 0243cc603..8d962a619 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
@@ -54,6 +54,7 @@ import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+import org.eclipse.team.internal.ccvs.core.util.Util;
/**
* This class provides static methods for checking out projects from a repository
@@ -223,20 +224,6 @@ public class CVSWorkspaceRoot {
throw eHolder[0];
}
}
-
- private static void manageFolder(ICVSFolder folder, String root) throws CVSException {
- // Ensure that the parent is a CVS folder
- ICVSFolder parent = folder.getParent();
- if (!parent.isCVSFolder()) {
- parent.setFolderSyncInfo(new FolderSyncInfo(FolderSyncInfo.VIRTUAL_DIRECTORY, root, CVSTag.DEFAULT, true));
- IResource resource = parent.getIResource();
- if (resource.getType() != IResource.PROJECT) {
- manageFolder(parent, root);
- }
- }
- // reset the folder sync info so it will be managed by it's parent
- folder.setFolderSyncInfo(folder.getFolderSyncInfo());
- }
/**
* Create a remote module in the CVS repository and link the project directory to this remote module.
@@ -325,7 +312,7 @@ public class CVSWorkspaceRoot {
}
// Ensure that the provided location is managed
- ICVSRepositoryLocation location = CVSProviderPlugin.getPlugin().getRepository(info.getRoot());
+ CVSProviderPlugin.getPlugin().getRepository(info.getRoot());
// Register the project with Team
RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
@@ -372,7 +359,7 @@ public class CVSWorkspaceRoot {
/*
* Delete the target projects before checking out
*/
- private static void scrubProjects(IProject[] projects, IProgressMonitor monitor) throws CVSException {
+ /* internal use only */ static void scrubProjects(IProject[] projects, IProgressMonitor monitor) throws CVSException {
if (projects == null) {
monitor.done();
return;
@@ -431,7 +418,7 @@ public class CVSWorkspaceRoot {
/*
* Bring the provied projects into the workspace
*/
- private static void refreshProjects(IProject[] projects, IProgressMonitor monitor) throws CoreException, TeamException {
+ /* internal use only */ static void refreshProjects(IProject[] projects, IProgressMonitor monitor) throws CoreException, TeamException {
monitor.beginTask(Policy.bind("CVSProvider.Creating_projects_2"), projects.length * 100); //$NON-NLS-1$
try {
for (int i = 0; i < projects.length; i++) {
@@ -477,29 +464,22 @@ public class CVSWorkspaceRoot {
return new RemoteFolder(null, CVSProviderPlugin.getPlugin().getRepository(syncInfo.getRoot()), syncInfo.getRepository(), syncInfo.getTag());
}
} else {
- if (resource.isManaged())
- return RemoteFile.getBase((RemoteFolder)getRemoteResourceFor(resource.getParent()), (ICVSFile)resource);
- }
- return null;
- }
-
- public static ICVSRemoteResource getBaseFor(ICVSResource resource) throws CVSException {
- if (resource.isFolder()) {
- ICVSFolder folder = (ICVSFolder)resource;
- FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
- if (syncInfo != null) {
- return new RemoteFolder(null, CVSProviderPlugin.getPlugin().getRepository(syncInfo.getRoot()), syncInfo.getRepository(), syncInfo.getTag());
+ if (resource.isManaged()) {
+ RemoteFolder parent = (RemoteFolder)getRemoteResourceFor(resource.getParent());
+ if (parent == null) {
+ // This could be caused by another thread changing the state in the
+ // instant between when we did the managed check and we obtained the
+ // parent handle. If this is the case, isManaged should return false
+ // now. If it doesn't, then we should log an error.
+ if (resource.isManaged()) {
+ CVSProviderPlugin.log(new CVSException(Policy.bind("CVSWorkspaceRoot.11", Util.getFullestPath(resource)))); //$NON-NLS-1$
+ }
+ } else {
+ return RemoteFile.getBase(parent, (ICVSFile)resource);
}
- } else {
- if (resource.isManaged())
- return RemoteFile.getBase((RemoteFolder)getRemoteResourceFor(resource.getParent()), (ICVSFile)resource);
}
- return null;
}
-
- public static ICVSRemoteResource getBaseFor(IResource resource) throws CVSException {
- ICVSResource managed = getCVSResourceFor(resource);
- return getBaseFor(managed);
+ return null;
}
/*
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 b9502c9d9..3643ecee4 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
@@ -78,6 +78,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, IStora
* even if the resource does exists remotely (e.g. created by another party).
*/
public static RemoteFile getBase(RemoteFolder parent, ICVSFile managed) throws CVSException {
+ Assert.isNotNull(parent, "A parent folder must be provided for file " + managed.getName()); //$NON-NLS-1$
byte[] syncBytes = managed.getSyncBytes();
if ((syncBytes == null) || ResourceSyncInfo.isAddition(syncBytes)) {
// Either the file is unmanaged or has just been added (i.e. doesn't necessarily have a remote)
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
index 3d90f555f..1b9977154 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
@@ -141,7 +141,6 @@ public class Util {
String truncatedPath = toTruncatedPath(stringPath, split);
// Special handling when the root is a project.
// Append project name to the beginning of the path
- IProject project = null;
IResource iResource = root.getIResource();
if (iResource != null && iResource.getType() == IResource.PROJECT) {
truncatedPath = iResource.getName() + Session.SERVER_SEPARATOR + truncatedPath;
@@ -516,4 +515,29 @@ public class Util {
return tag;
}
+
+ /**
+ * Return the fullest path that we can obtain for the given resource
+ * @param resource
+ * @return
+ */
+ public static String getFullestPath(ICVSResource resource) {
+ try {
+ IResource local = resource.getIResource();
+ if (local != null) {
+ return local.getFullPath().toString();
+ }
+ } catch (CVSException e) {
+ // Ignore and try the next method;
+ }
+ try {
+ String remotePath = resource.getRepositoryRelativePath();
+ if (remotePath != null) {
+ return remotePath;
+ }
+ } catch (CVSException e) {
+ // Ignore and try the next method;
+ }
+ return resource.getName();
+ }
}

Back to the top