Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-03-14 20:28:32 +0000
committerMichael Valenta2002-03-14 20:28:32 +0000
commit69c9a3531f921ac5e5d491be1b65fec95ec8ccd4 (patch)
treece0c141758e3ac3df08f3776fc10abbf0806b4cb
parent1b53d75dbe637fe3edcbd13d167e31055864c9bf (diff)
downloadeclipse.platform.team-69c9a3531f921ac5e5d491be1b65fec95ec8ccd4.tar.gz
eclipse.platform.team-69c9a3531f921ac5e5d491be1b65fec95ec8ccd4.tar.xz
eclipse.platform.team-69c9a3531f921ac5e5d491be1b65fec95ec8ccd4.zip
11331: CVS hangs during replace
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java2
-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.java17
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java2
5 files changed, 15 insertions, 10 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java
index 981c6c2d0..b6be92849 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSFile.java
@@ -50,7 +50,7 @@ public interface ICVSFile extends ICVSResource {
* CREATED - contents for a file that doesn't exist locally
* UPDATE_EXISTING - Replacing a local file with no local changes with remote changes.
*/
- OutputStream getOutputStream(int responseType) throws CVSException;
+ OutputStream getOutputStream(int responseType, boolean keepLocalHistory) throws CVSException;
/**
* Gets an appending output stream for writing to the file.
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 b492a3cfd..1a0991b51 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
@@ -626,7 +626,7 @@ public class Session {
throw new CVSException(Policy.bind("Session.badInt"), e); //$NON-NLS-1$
}
// obtain an output stream for the file
- OutputStream out = file.getOutputStream(responseType);
+ OutputStream out = file.getOutputStream(responseType, true);
try {
transferWithProgress(connection.getInputStream(), out, size, SERVER_NEWLINE_BYTE,
isBinary ? null : PLATFORM_NEWLINE_BYTES, monitor, title);
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 26352f208..bc7205d57 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
@@ -68,7 +68,7 @@ class EclipseFile extends EclipseResource implements ICVSFile {
}
}
- public OutputStream getOutputStream(final int responseType) throws CVSException {
+ public OutputStream getOutputStream(final int responseType, final boolean keepLocalHistory) throws CVSException {
return new ByteArrayOutputStream() {
public void close() throws IOException {
try {
@@ -76,13 +76,16 @@ class EclipseFile extends EclipseResource implements ICVSFile {
if (responseType == CREATED || (responseType == UPDATED && ! resource.exists())) {
file.create(new ByteArrayInputStream(toByteArray()), false /*force*/, null);
} else if(responseType == UPDATE_EXISTING) {
- file.setContents(new ByteArrayInputStream(toByteArray()), false /*force*/, true /*keep history*/, null);
+ file.setContents(new ByteArrayInputStream(toByteArray()), false /*force*/, keepLocalHistory /*keep history*/, null);
} else {
- // Ensure we don't leave the file in a partially written state
- IFile tempFile = file.getParent().getFile(new Path(file.getName() + TEMP_FILE_EXTENSION));
- tempFile.create(new ByteArrayInputStream(toByteArray()), true /*force*/, null);
- file.delete(false, true, null);
- tempFile.move(new Path(file.getName()), true, true, null);
+
+ file.setContents(new ByteArrayInputStream(toByteArray()), false /*force*/, keepLocalHistory /*keep history*/, null);
+
+// // Ensure we don't leave the file in a partially written state
+// IFile tempFile = file.getParent().getFile(new Path(file.getName() + TEMP_FILE_EXTENSION));
+// tempFile.create(new ByteArrayInputStream(toByteArray()), true /*force*/, null);
+// file.delete(false, true, null);
+// tempFile.move(new Path(file.getName()), true, true, null);
}
} catch(CoreException e) {
throw new IOException(Policy.bind("EclipseFile_Problem_creating_resource", e.getMessage())); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
index 871b10251..a8a129925 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -240,6 +240,7 @@ public class EclipseSynchronizer {
SyncFileWriter.writeFolderSync(cvsFolder, info);
}
}
+ Policy.checkCanceled(monitor);
monitor.worked(1);
}
@@ -256,6 +257,7 @@ public class EclipseSynchronizer {
ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(folder);
SyncFileWriter.writeAllResourceSync(cvsFolder, infos);
}
+ Policy.checkCanceled(monitor);
monitor.worked(1);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
index 1073bf343..3142fa235 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/SyncFileWriter.java
@@ -283,7 +283,7 @@ public class SyncFileWriter {
* compatibility with other CVS clients.
*/
private static void writeLines(ICVSFile file, String[] contents) throws CVSException {
- OutputStream os = new BufferedOutputStream(file.getOutputStream(ICVSFile.UPDATED));
+ OutputStream os = new BufferedOutputStream(file.getOutputStream(ICVSFile.UPDATED, false));
writeLinesToStreamAndClose(os, contents);
}

Back to the top