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/resources/RemoteFile.java3
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java25
2 files changed, 28 insertions, 0 deletions
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 c78effdac..237191eea 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
@@ -85,6 +85,9 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
// Either the file is unmanaged or has just been added (i.e. doesn't necessarily have a remote)
return null;
}
+ if (ResourceSyncInfo.isDeletion(syncBytes)) {
+ syncBytes = ResourceSyncInfo.convertFromDeletion(syncBytes);
+ }
RemoteFile file = new RemoteFile(parent, syncBytes);
parent.setChildren(new ICVSRemoteResource[] {file});
return file;
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
index b32986694..6e32a158a 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
@@ -346,5 +346,30 @@ public class RemoteResourceTest extends EclipseTest {
private ICVSRemoteFolder checkoutRemote(ICVSRemoteFolder remote) throws CVSException, InvocationTargetException, InterruptedException {
return CheckoutToRemoteFolderOperation.checkoutRemoteFolder(null, remote, DEFAULT_MONITOR);
}
+
+ public void testContentFetchForLocalDeletion() throws TeamException, IOException, CoreException {
+ IProject project = createProject(new String[] { "file1.txt"});
+ String contents = "the file contents";
+ setContentsAndEnsureModified(project.getFile("file1.txt"), contents);
+ commitProject(project);
+ project.getFile("file1.txt").delete(false, null);
+ ICVSRemoteFile remote = (ICVSRemoteFile)CVSWorkspaceRoot.getRemoteResourceFor(project.getFile("file1.txt"));
+ String fetchedContents = asString(remote.getBufferedStorage(DEFAULT_MONITOR).getContents());
+ assertEquals("Contents do not match", contents, fetchedContents);
+ }
+
+ /**
+ * @param stream
+ * @return
+ */
+ private String asString(InputStream stream) throws IOException {
+ StringBuffer buffer = new StringBuffer();
+ int b = stream.read();
+ while (b != -1) {
+ buffer.append((char)b);
+ b = stream.read();
+ }
+ return buffer.toString();
+ }
}

Back to the top