Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-07-10 18:13:07 +0000
committerMichael Valenta2003-07-10 18:13:07 +0000
commit4fa6aa0269ac033e59618f5b370adbc062f149f6 (patch)
tree010c19ee5a29b46d069bad890fc6d3149c1809a7
parent776685314775ad796e21371c13c9b5f9fbf7899b (diff)
downloadeclipse.platform.team-4fa6aa0269ac033e59618f5b370adbc062f149f6.tar.gz
eclipse.platform.team-4fa6aa0269ac033e59618f5b370adbc062f149f6.tar.xz
eclipse.platform.team-4fa6aa0269ac033e59618f5b370adbc062f149f6.zip
31453: [CVS Sync View] Synchronizing with server transfers entire binary JAR to figure it is any different
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java10
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java15
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java18
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java31
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java2
6 files changed, 64 insertions, 13 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
index 406548dd1..c3693a804 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/AbstractStructureVisitor.java
@@ -44,14 +44,20 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor {
protected IProgressMonitor monitor;
protected boolean sendQuestionable;
protected boolean sendModifiedContents;
+ private boolean sendBinary;
public AbstractStructureVisitor(Session session, boolean sendQuestionable, boolean sendModifiedContents, IProgressMonitor monitor) {
+ this(session, sendQuestionable, sendModifiedContents, true, monitor);
+ }
+
+ public AbstractStructureVisitor(Session session, boolean sendQuestionable, boolean sendModifiedContents, boolean sendBinary, IProgressMonitor monitor) {
this.session = session;
this.sendQuestionable = sendQuestionable;
this.sendModifiedContents = sendModifiedContents;
+ this.sendBinary = sendBinary;
this.monitor = Policy.infiniteSubMonitorFor(monitor, 256);
}
-
+
/**
* Helper method to indicate if a directory has already been sent to the server
*/
@@ -175,7 +181,7 @@ abstract class AbstractStructureVisitor implements ICVSResourceVisitor {
if (mFile.isModified(null)) {
boolean binary = ResourceSyncInfo.isBinary(syncBytes);
if (sendModifiedContents) {
- session.sendModified(mFile, binary, monitor);
+ session.sendModified(mFile, binary, sendBinary, monitor);
} else {
session.sendIsModified(mFile, binary, monitor);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
index 371205019..0b7541c74 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java
@@ -58,6 +58,7 @@ public abstract class Command extends Request {
public final static Tag CUSTOM_TAG = new Tag(true);
public final static RTag RTAG = new RTag();
public final static Update UPDATE = new Update();
+ public final static SyncUpdate SYNCUPDATE = new SyncUpdate();
public final static Version VERSION = new Version();
public final static NOOPCommand NOOP = new NOOPCommand();
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
index f2197b08e..b751c8043 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/FileStructureVisitor.java
@@ -30,17 +30,14 @@ import org.eclipse.team.internal.ccvs.core.ICVSResource;
class FileStructureVisitor extends AbstractStructureVisitor {
- private final boolean sendEmptyFolders;
+ private boolean sendEmptyFolders;
- /**
- * Constructor for the visitor
- *
- * @param modifiedOnly sends files that are modified only to the server
- * @param emptyFolders sends the folder-entrie even if there is no file to send in it
- */
public FileStructureVisitor(Session session, boolean sendEmptyFolders, boolean sendModifiedContents, IProgressMonitor monitor) {
-
- super(session, true, sendModifiedContents, monitor);
+ this(session, true, sendModifiedContents, true, monitor);
+ }
+
+ public FileStructureVisitor(Session session, boolean sendEmptyFolders, boolean sendModifiedContents, boolean sendBinary, IProgressMonitor monitor) {
+ super(session, true, sendModifiedContents, sendBinary, monitor);
this.sendEmptyFolders = sendEmptyFolders;
}
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 0dbef02a0..6d7193259 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.core.client;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -880,12 +881,17 @@ public class Session {
*/
public void sendModified(ICVSFile file, boolean isBinary, IProgressMonitor monitor)
throws CVSException {
+ sendModified(file, isBinary, true, monitor);
+ }
+
+ public void sendModified(ICVSFile file, boolean isBinary, boolean sendBinary, IProgressMonitor monitor)
+ throws CVSException {
String filename = file.getName();
connection.writeLine("Modified " + filename); //$NON-NLS-1$
// send the default permissions for now
connection.writeLine(ResourceSyncInfo.getDefaultPermissions());
- sendFile(file, isBinary, monitor);
+ sendFile(file, isBinary, sendBinary, monitor);
}
/**
@@ -902,6 +908,10 @@ public class Session {
* @param monitor the progress monitor
*/
public void sendFile(ICVSFile file, boolean isBinary, IProgressMonitor monitor) throws CVSException {
+ sendFile(file, isBinary, true, monitor);
+ }
+
+ public void sendFile(ICVSFile file, boolean isBinary, boolean sendBinary, IProgressMonitor monitor) throws CVSException {
// check overrides
if (textTransferOverrideSet != null &&
textTransferOverrideSet.contains(file)) isBinary = false;
@@ -913,6 +923,12 @@ public class Session {
InputStream in = null;
long length;
try {
+ if (isBinary && !sendBinary) {
+ byte[] bytes = "hello".getBytes(); //$NON-NLS-1$
+ sendUncompressedBytes(new ByteArrayInputStream(bytes), bytes.length);
+ return;
+ }
+
if (compressionLevel == 0) {
in = file.getContents();
if (!isBinary && IS_CRLF_PLATFORM){
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java
new file mode 100644
index 000000000..a42791c50
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/SyncUpdate.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.core.client;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.ICVSResource;
+
+public class SyncUpdate extends Update {
+
+ public SyncUpdate() { };
+
+ /*
+ * @see Command#sendFileStructure(ICVSResource,IProgressMonitor,boolean,boolean,boolean)
+ */
+ protected void sendFileStructure(Session session, ICVSResource[] resources,
+ boolean emptyFolders, IProgressMonitor monitor) throws CVSException {
+
+ checkResourcesManaged(resources);
+ new FileStructureVisitor(session, false, true, false, monitor).visit(session, resources);
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
index 301ef5e2f..478fbbed1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java
@@ -575,7 +575,7 @@ public class RemoteFolderTreeBuilder {
// Perform a "cvs -n update -d [-r tag] ." in order to get the
// messages from the server that will indicate what has changed on the
// server.
- IStatus status = Command.UPDATE.execute(session,
+ IStatus status = Command.SYNCUPDATE.execute(session,
new GlobalOption[] { Command.DO_NOT_CHANGE },
updateLocalOptions,
arguments,

Back to the top