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/ICVSResource.java11
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CRLFDetectInputStream.java25
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java11
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java10
5 files changed, 56 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
index 9ec8465e5..c0531bd3a 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSResource.java
@@ -103,12 +103,23 @@ public interface ICVSResource {
/**
* Answers the local relative path from the given ancestor to the receiver.
+ * This method will return a path for files that are themselves not added
+ * to CVS control but who have an ancestor that is under CVS control.
*
* @return the ancestor relative path for this resource.
*/
public String getRelativePath(ICVSFolder ancestor) throws CVSException;
/**
+ * Return the repository relative path of the remote resource. Return
+ * <code>null</code> if the resource is not under CVS control.
+ *
+ * @return
+ * @throws CVSException
+ */
+ public String getRepositoryRelativePath() throws CVSException;
+
+ /**
* Get the absolute remote location of a resource. This method is used by
* the CVS command infrastructure during command execution. The root is used
* in situations where the resource is not under CVS control. The remote
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CRLFDetectInputStream.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CRLFDetectInputStream.java
index 257a54df6..a16860c4c 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CRLFDetectInputStream.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/CRLFDetectInputStream.java
@@ -14,8 +14,11 @@ import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.Policy;
/**
@@ -26,9 +29,27 @@ public class CRLFDetectInputStream extends FilterInputStream {
private boolean previousCR;
private String filename;
- protected CRLFDetectInputStream(InputStream in, String filename) {
+ protected CRLFDetectInputStream(InputStream in, ICVSFile file) {
super(in);
- this.filename = filename;
+ try {
+ this.filename = getFileName(file);
+ } catch (CVSException e) {
+ this.filename = file.getName();
+ }
+ }
+
+ private String getFileName(ICVSFile file) throws CVSException {
+ String fileName = file.getRepositoryRelativePath();
+ if (fileName == null) {
+ IResource resource = file.getIResource();
+ if (resource == null) {
+ fileName = file.getName();
+ } else {
+ // Use the resource path if there is one since the remote pat
+ fileName = file.getIResource().getFullPath().toString();
+ }
+ }
+ return fileName;
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
index fc3ca90ed..4efd26090 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java
@@ -954,7 +954,7 @@ public class Session {
in = new LFtoCRLFInputStream(in);
} else {
// be nice and warn about text files that contain CRLF
- in = new CRLFDetectInputStream(in, file.getIResource().getFullPath().toString());
+ in = new CRLFDetectInputStream(in, file);
}
}
// write the file locally
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
index 3305c6489..bf57cf4b2 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
@@ -33,6 +33,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.Policy;
+import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.syncinfo.BaserevInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
@@ -557,6 +558,16 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
getParent().run(job, monitor);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.ICVSResource#getRepositoryRelativePath()
+ */
+ public String getRepositoryRelativePath() throws CVSException {
+ if (!isManaged()) return null;
+ String parentPath = getParent().getRepositoryRelativePath();
+ if (parentPath == null) return null;
+ return parentPath + Session.SERVER_SEPARATOR + getName();
+ }
+
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
index 79b1af1b0..b730a435b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFolder.java
@@ -401,4 +401,14 @@ class EclipseFolder extends EclipseResource implements ICVSFolder {
return false;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.core.ICVSResource#getRepositoryRelativePath()
+ */
+ public String getRepositoryRelativePath() throws CVSException {
+ FolderSyncInfo info = getFolderSyncInfo();
+ if (info == null) return null;
+ // The REPOSITORY property of the folder info is the repository relative path
+ return info.getRepository();
+ }
}

Back to the top