Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-09-12 16:32:04 -0400
committerMichael Valenta2003-09-12 16:32:04 -0400
commitfdf0c38562b25724fdb237dddaba940043a3114c (patch)
treeb566e40eb58665e28d8306fb6239a07e54327a84
parent1930392bc918e30f5ed2c8f96fa0024d69d006db (diff)
downloadeclipse.platform.team-fdf0c38562b25724fdb237dddaba940043a3114c.tar.gz
eclipse.platform.team-fdf0c38562b25724fdb237dddaba940043a3114c.tar.xz
eclipse.platform.team-fdf0c38562b25724fdb237dddaba940043a3114c.zip
Fix to ensure RemoteFile has a keyword mode whenever possible
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java56
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java4
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java28
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java1
7 files changed, 78 insertions, 23 deletions
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 6ce7a2c1d..f23cc3f59 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
@@ -583,7 +583,7 @@ public abstract class Command extends Request {
*/
public static KSubstOption fromFile(IFile file) {
if (CVSProviderPlugin.isText(file))
- return CVSProviderPlugin.getPlugin().getDefaultTextKSubstOption();
+ return getDefaultTextMode();
return KSUBST_BINARY;
}
/**
@@ -620,6 +620,12 @@ public abstract class Command extends Request {
if (isUnknownMode) return Policy.bind("KSubstOption.unknown.long", option); //$NON-NLS-1$
return Policy.bind("KSubstOption." + option + ".long"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ /**
+ * Return the text mode that will be used by default
+ */
+ public static KSubstOption getDefaultTextMode() {
+ return CVSProviderPlugin.getPlugin().getDefaultTextKSubstOption();
+ }
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
index 710f98d1e..c2a3c1010 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/CVSRepositoryLocation.java
@@ -273,7 +273,7 @@ public class CVSRepositoryLocation extends PlatformObject implements ICVSReposit
public ICVSRemoteFile getRemoteFile(String remotePath, CVSTag tag) {
IPath path = new Path(remotePath);
RemoteFolderTree remoteFolder = new RemoteFolderTree(null, this, path.removeLastSegments(1).toString(), tag);
- RemoteFile remoteFile = new RemoteFile(remoteFolder, Update.STATE_ADDED_LOCAL, path.lastSegment(), tag);
+ RemoteFile remoteFile = new RemoteFile(remoteFolder, Update.STATE_ADDED_LOCAL, path.lastSegment(), null, null, tag);
remoteFolder.setChildren(new ICVSRemoteResource[] { remoteFile });
return remoteFile;
}
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 e88fe768f..ed0406d2e 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
@@ -42,6 +42,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.client.Log;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.Update;
@@ -104,30 +105,44 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
parent.setChildren(new ICVSRemoteResource[] {file});
return file;
}
-
+
/**
* Constructor for RemoteFile that should be used when nothing is know about the
* file ahead of time.
+ * @param parent the folder that is the parent of the file
+ * @param workspaceSyncState the workspace state (use Update.STATE_NONE if unknown)
+ * @param name the name of the file
+ * @param revision revision of the file or <code>null</code> if the revision is not known
+ * @param keywordMode keyword mode of the file or <code>null</code> if the mode is not known
+ * @param tag tag for the file
*/
- public RemoteFile(RemoteFolder parent, int workspaceSyncState, String name, CVSTag tag) {
- this(parent, workspaceSyncState, name, ResourceSyncInfo.ADDED_REVISION, tag); //$NON-NLS-1$
+ public RemoteFile(RemoteFolder parent, int workspaceSyncState, String name, String revision, KSubstOption keywordMode, CVSTag tag) {
+ this(parent, name, workspaceSyncState, getSyncBytes(name, revision, keywordMode, tag));
}
- public RemoteFile(RemoteFolder parent, int workspaceSyncState, String name, String revision, CVSTag tag) {
- super(parent, name);
+ private static byte[] getSyncBytes(String name, String revision, KSubstOption keywordMode, CVSTag tag) {
+ if (revision == null) {
+ revision = ResourceSyncInfo.ADDED_REVISION;
+ }
+ if (keywordMode == null) {
+ keywordMode = KSubstOption.getDefaultTextMode();
+ }
MutableResourceSyncInfo newInfo = new MutableResourceSyncInfo(name, revision);
- newInfo.setKeywordMode(Command.KSUBST_TEXT_EXPAND);
+ newInfo.setKeywordMode(keywordMode);
newInfo.setTag(tag);
- syncBytes = newInfo.getBytes();
- setWorkspaceSyncState(workspaceSyncState);
+ return newInfo.getBytes();
}
-
- public RemoteFile(RemoteFolder parent, byte[] syncBytes) throws CVSException {
+
+ /* package */ RemoteFile(RemoteFolder parent, byte[] syncBytes) throws CVSException {
this(parent, Update.STATE_NONE, syncBytes);
}
- public RemoteFile(RemoteFolder parent, int workspaceSyncState, byte[] syncBytes) throws CVSException {
- super(parent, ResourceSyncInfo.getName(syncBytes));
+ /* package */ RemoteFile(RemoteFolder parent, int workspaceSyncState, byte[] syncBytes) throws CVSException {
+ this(parent, ResourceSyncInfo.getName(syncBytes), workspaceSyncState, syncBytes);
+ }
+
+ private RemoteFile(RemoteFolder parent, String name, int workspaceSyncState, byte[] syncBytes) {
+ super(parent, name);
this.syncBytes = syncBytes;
setWorkspaceSyncState(workspaceSyncState);
}
@@ -277,6 +292,15 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
}
}
+ private KSubstOption getKeywordMode() {
+ try {
+ return ResourceSyncInfo.getKeywordMode(syncBytes);
+ } catch (CVSException e) {
+ CVSProviderPlugin.log(e);
+ return KSubstOption.getDefaultTextMode();
+ }
+ }
+
/*
* Get a different revision of the remote file.
*
@@ -285,11 +309,11 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
*/
public RemoteFile toRevision(String revision) {
RemoteFolder newParent = new RemoteFolder(null, parent.getRepository(), parent.getRepositoryRelativePath(), parent.getTag());
- RemoteFile file = new RemoteFile(newParent, getWorkspaceSyncState(), getName(), revision, CVSTag.DEFAULT);
+ RemoteFile file = new RemoteFile(newParent, getWorkspaceSyncState(), getName(), revision, getKeywordMode(), CVSTag.DEFAULT);
newParent.setChildren(new ICVSRemoteResource[] {file});
return file;
}
-
+
/**
* @see ICVSFile#getSize()
*/
@@ -522,8 +546,8 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
/**
* @see RemoteResource#forTag(ICVSRemoteFolder, CVSTag)
*/
- public ICVSRemoteResource forTag(ICVSRemoteFolder parent, CVSTag tagName) {
- return new RemoteFile((RemoteFolder)parent, getWorkspaceSyncState(), getName(), tagName);
+ public ICVSRemoteResource forTag(ICVSRemoteFolder parent, CVSTag tag) {
+ return new RemoteFile((RemoteFolder)parent, getWorkspaceSyncState(), getName(), getRevision(), getKeywordMode(), tag);
}
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
index 7a74828da..1580a471f 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderMemberFetcher.java
@@ -265,7 +265,7 @@ public class RemoteFolderMemberFetcher implements IUpdateMessageListener, IStatu
/**
* This method is invoked for each child file as the reponses are being recieved from
- * the server. Default behavior is to record the file for later retrieval using <code>getChilren()</code>.
+ * the server. Default behavior is to record the file for later retrieval using <code>getChildren()</code>.
* Subclasses may override but should invoke the inherited method to ensure the file gets recorded.
* This is important because the file revisions for any files are fetched subsequent to the fecthing
* of the children.
@@ -276,6 +276,8 @@ public class RemoteFolderMemberFetcher implements IUpdateMessageListener, IStatu
parentFolder,
Update.STATE_NONE,
name,
+ null, /* revision unknown */
+ null, /* keyword mode unknown */
tag);
files.add(file);
return file;
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 6c28b26c5..adf3f3c20 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
@@ -329,7 +329,12 @@ public class RemoteFolderTreeBuilder {
if (d.getRevision() == DELETED) {
return null;
}
- remoteFile = new RemoteFile(remoteRoot, d.getSyncState(), file.getName(), tagForRemoteFolder(remoteRoot, tag));
+ remoteFile = new RemoteFile(remoteRoot,
+ d.getSyncState(),
+ file.getName(),
+ null, /* the revision will be retrieved from the server */
+ getKeywordMode(file), /* use the same keyword mode a the local file */
+ tagForRemoteFolder(remoteRoot, tag));
}
// Add the resource to its parent
remoteRoot.setChildren(new ICVSRemoteResource[] {remoteFile});
@@ -353,6 +358,13 @@ public class RemoteFolderTreeBuilder {
}
}
+ private Command.KSubstOption getKeywordMode(ICVSFile file) throws CVSException {
+ if (file == null) return null;
+ byte[] syncBytes = file.getSyncBytes();
+ if (syncBytes == null) return null;
+ return ResourceSyncInfo.getKeywordMode(syncBytes);
+ }
+
/*
* Build the base remote tree from the local tree.
*
@@ -480,12 +492,22 @@ public class RemoteFolderTreeBuilder {
Util.appendPath(remote.getRepositoryRelativePath(), name),
tagForRemoteFolder(remote, tag)));
} else if (revision == ADDED) {
- children.put(name, new RemoteFile(remote, d.getSyncState(), name, tagForRemoteFolder(remote, tag)));
+ children.put(name, new RemoteFile(remote,
+ d.getSyncState(),
+ name,
+ null, /* the revision will be fetched later */
+ null, /* there's no way to know the remote keyword mode */
+ tagForRemoteFolder(remote, tag)));
} else if (revision == UNKNOWN) {
// The local resource is out of sync with the remote.
// Create a RemoteFile associated with the tag so we are assured of getting the proper revision
// (Note: this will replace the RemoteFile added from the local base)
- children.put(name, new RemoteFile(remote, d.getSyncState(), name, tagForRemoteFolder(remote, tag)));
+ children.put(name, new RemoteFile(remote,
+ d.getSyncState(),
+ name,
+ null, /* the revision will be fetched later */
+ getKeywordMode((ICVSFile)children.get(name)), /* get the keyword mode from the local file*/
+ tagForRemoteFolder(remote, tag)));
} else if (revision == DELETED) {
// This should have been deleted while creating from the local resources.
// If it wasn't, delete it now.
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
index 75119ad26..770092da1 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteModule.java
@@ -153,7 +153,7 @@ public class RemoteModule extends RemoteFolder {
if ( ! files.isEmpty()) {
ICVSRemoteResource[] children = new ICVSRemoteResource[files.size()];
for (int j = 0; j < children.length; j++) {
- children[j] = new RemoteFile(remoteModule, Update.STATE_NONE, (String)files.get(j), tag);
+ children[j] = new RemoteFile(remoteModule, Update.STATE_NONE, (String)files.get(j), null, null, tag);
remoteModule.setChildren(children);
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
index c55c93766..5dc678348 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/RemoteTagSynchronizer.java
@@ -79,6 +79,7 @@ public class RemoteTagSynchronizer extends CVSRemoteSynchronizer {
if (!children.containsKey(resource)) {
// These sync bytes are stale. Purge them
removeSyncBytes(resource, IResource.DEPTH_INFINITE);
+ changedResources.add(resource);
}
}
}

Back to the top