Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-30 14:27:45 +0000
committerJean Michel-Lemieux2002-04-30 14:27:45 +0000
commita53b502308682e06476375cc8c7edd97703a00fc (patch)
tree5c84e20952ee58031c1ff40971e12d275ecfc1ff
parent240305b1bfd6a0f1336f36a444ce307a5a20d4f4 (diff)
downloadeclipse.platform.team-a53b502308682e06476375cc8c7edd97703a00fc.tar.gz
eclipse.platform.team-a53b502308682e06476375cc8c7edd97703a00fc.tar.xz
eclipse.platform.team-a53b502308682e06476375cc8c7edd97703a00fc.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html9
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml2
-rw-r--r--bundles/org.eclipse.team.cvs.core/plugin.xml2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java30
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Session.java16
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java69
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java224
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolderTreeBuilder.java67
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java7
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingInputStream.java42
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingOutputStream.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/SizeConstrainedInputStream.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java8
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java20
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java23
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java17
-rw-r--r--bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html2
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java7
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java2
30 files changed, 355 insertions, 344 deletions
diff --git a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html b/bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html
index cf37ed5f7..a001ac9a1 100644
--- a/bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html
+++ b/bundles/org.eclipse.team.core/doc/org_eclipse_team_core.html
@@ -12,6 +12,15 @@ This document lists all of the extension points that the Team Core plug-in makes
<p>
<hr WIDTH="100%">
<h1>General Extension Points</h1>
+The following extension points can be used to extend various aspects of the team functionality:
+<ul>
+<li>
+<a href="org_eclipse_team_core_fileTypes.html">org.eclipse.team.core.fileTypes</a></li>
+<li>
+<a href="org_eclipse_team_core_ignore.html">org.eclipse.team.core.ignore</a></li>
+<li>
+<a href="org_eclipse_team_core_projectSets.html">org.eclipse.team.core.projectSets</a></li>
+</ul>
<a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corp. 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a>
</body>
</html>
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index a6842badc..cf1475485 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -3,7 +3,7 @@
<plugin
id="org.eclipse.team.core"
name="%pluginName"
- version="2.0.0"
+ version="1.9.0"
provider-name="Object Technology International, Inc."
class="org.eclipse.team.core.TeamPlugin">
<requires>
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml
index a89ad30b0..20ea792b2 100644
--- a/bundles/org.eclipse.team.cvs.core/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.core/plugin.xml
@@ -2,7 +2,7 @@
<plugin
name="%pluginName"
id="org.eclipse.team.cvs.core"
- version="2.0.0"
+ version="1.9.0"
class="org.eclipse.team.internal.ccvs.core.CVSProviderPlugin"
provider-name="Object Technology International, Inc.">
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
index 161aee9c1..eb71760b5 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java
@@ -1,10 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.team.internal.ccvs.core.client;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -19,7 +24,7 @@ import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
-public class RTag extends Command {
+public class RTag extends RemoteCommand {
/*** Local options: specific to tag ***/
public static final LocalOption CREATE_BRANCH = Tag.CREATE_BRANCH;
@@ -42,7 +47,6 @@ public class RTag extends Command {
}
}
- protected RTag() { }
protected String getRequestId() {
return "rtag"; //$NON-NLS-1$
}
@@ -50,17 +54,7 @@ public class RTag extends Command {
protected ICVSResource[] computeWorkResources(Session session, LocalOption[] localOptions,
String[] arguments) throws CVSException {
if (arguments.length < 2) throw new IllegalArgumentException();
- return new ICVSResource[0];
- }
-
- protected void sendLocalResourceState(Session session, GlobalOption[] globalOptions,
- LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor)
- throws CVSException {
- // do nothing
- }
-
- protected void sendLocalWorkingDirectory(Session session) throws CVSException {
- // do nothing
+ return super.computeWorkResources(session, localOptions, arguments);
}
public IStatus execute(Session session, GlobalOption[] globalOptions,
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 127f3ca5b..ded3e384d 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
@@ -1,9 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.team.internal.ccvs.core.client;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -897,6 +902,7 @@ public class Session {
in = new ProgressMonitorInputStream(in, size, TRANSFER_PROGRESS_INCREMENT, monitor) {
protected void updateMonitor(long bytesRead, long bytesTotal, IProgressMonitor monitor) {
if (bytesRead == 0) return;
+ Assert.isTrue(bytesRead <= bytesTotal);
monitor.subTask(Policy.bind("Session.transfer", //$NON-NLS-1$
new Object[] { title, Long.toString(bytesRead >> 10), Long.toString(bytesTotal >> 10) }));
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java
index 4064aefc4..af1ca8917 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Version.java
@@ -29,7 +29,7 @@ import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
* Concurrent Versions System (CVS) NT 1.11.1.1 (Build 27)
* Concurrent Versions System (CVSNT) 1.11.1.3 (Build 57a) (client/server)
*/
-public class Version extends AbstractMessageCommand {
+public class Version extends RemoteCommand {
private static final String CVS_NT_PREFIX_1 = "Concurrent Versions System (CVS) NT "; //$NON-NLS-1$
private static final String CVS_NT_PREFIX_2 = "Concurrent Versions System (CVSNT) "; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java
index 630da6e7c..3e68d7ce0 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/connection/Connection.java
@@ -63,19 +63,12 @@ public class Connection {
if (!isEstablished())
return;
try {
- // Perhaps it should be left to the connection to deal with reading pending input!
- readPendingInput();
- } catch (CVSException e) {
- // Ignore this exception since we don't care about it (i.e. we're closing)
+ serverConnection.close();
+ } catch (IOException ex) {
+ throw new CVSCommunicationException(Policy.bind("Connection.cannotClose"), ex);//$NON-NLS-1$
} finally {
- try {
- serverConnection.close();
- } catch (IOException ex) {
- throw new CVSCommunicationException(Policy.bind("Connection.cannotClose"), ex);//$NON-NLS-1$
- } finally {
- fResponseStream = null;
- fIsEstablished = false;
- }
+ fResponseStream = null;
+ fIsEstablished = false;
}
}
/**
@@ -155,47 +148,21 @@ public class Connection {
}
}
-static String readLine(InputStream in) throws IOException {
- byte[] buffer = new byte[256];
- int index = 0;
- int r;
- while ((r = in.read()) != -1) {
- if (r == NEWLINE)
- break;
- buffer = append(buffer, index++, (byte) r);
+ static String readLine(InputStream in) throws IOException {
+ byte[] buffer = new byte[256];
+ int index = 0;
+ int r;
+ while ((r = in.read()) != -1) {
+ if (r == NEWLINE)
+ break;
+ buffer = append(buffer, index++, (byte) r);
+ }
+ String result = new String(buffer, 0, index);
+ if (Policy.DEBUG_CVS_PROTOCOL)
+ System.out.println(result);
+ return result;
}
- String result = new String(buffer, 0, index);
- if (Policy.DEBUG_CVS_PROTOCOL)
- System.out.println(result);
- return result;
-}
- /**
- * Reads any pending input from the response stream so that
- * the stream can savely be closed.
- */
- protected void readPendingInput() throws CVSException {
- byte[] buffer= new byte[2048];
- InputStream in= getInputStream();
- OutputStream out= getOutputStream();
- try {
- while (true) {
- int available = in.available();
- if (available < 1) break;
- if (available > buffer.length) available = buffer.length;
- if (in.read(buffer, 0, available) < 1) break;
- }
- out.flush();
- while (true) {
- int available = in.available();
- if (available < 1) break;
- if (available > buffer.length) available = buffer.length;
- if (in.read(buffer, 0, available) < 1) break;
- }
- } catch (IOException e) {
- throw new CVSCommunicationException(e);
- }
- }
//---- Helper to send strings to the server ----------------------------
/**
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
index f108168c1..5730407a5 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot.java
@@ -109,8 +109,8 @@ public class CVSWorkspaceRoot {
remote = getRemoteTreeFromParent(resource, managed, tag, progress);
} else if(resource.getType() == IResource.FILE) {
baseTree = remote;
- ICVSRemoteResource remoteParent = CVSWorkspaceRoot.getRemoteResourceFor(resource.getParent());
- remote = RemoteFile.getLatest((RemoteFolder)remoteParent, (ICVSFile)managed, tag, progress);
+ ICVSRepositoryLocation location = remote.getRepository();
+ remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFile)managed, tag, progress);
} else {
ICVSRepositoryLocation location = remote.getRepository();
baseTree = RemoteFolderTreeBuilder.buildBaseTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
@@ -125,8 +125,8 @@ public class CVSWorkspaceRoot {
if (remote == null) {
remote = getRemoteTreeFromParent(resource, managed, tag, progress);
} else if(resource.getType() == IResource.FILE) {
- ICVSRemoteResource remoteParent = CVSWorkspaceRoot.getRemoteResourceFor(resource.getParent());
- remote = RemoteFile.getLatest((RemoteFolder)remoteParent, (ICVSFile)managed, tag, progress);
+ ICVSRepositoryLocation location = remote.getRepository();
+ remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFile)managed, tag, progress);
} else {
ICVSRepositoryLocation location = remote.getRepository();
remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
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 520b4b63a..2da15c4c8 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
@@ -53,6 +53,7 @@ import org.eclipse.team.internal.ccvs.core.client.listeners.LogListener;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+import org.eclipse.team.internal.ccvs.core.util.Util;
/**
* This class provides the implementation of ICVSRemoteFile and IManagedFile for
@@ -60,10 +61,10 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
*/
public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
- // Contents will be cahced to disk when this thrshold is exceeded
+ // Contents will be cached to disk when this thrshold is exceeded
private static final int CACHING_THRESHOLD = 32768;
- // cache for file contents received from the server
+ // buffer for file contents received from the server
private byte[] contents;
// cach the log entry for the remote file
private ILogEntry entry;
@@ -86,71 +87,6 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
parent.setChildren(new ICVSRemoteResource[] {file});
return file;
}
-
- /**
- * Static method which creates a file as a single child of its parent.
- * This should only be used when one is only interested in the file alone.
- *
- * The returned RemoteFile represents the latest remote revision corresponding to the local resource.
- * If the local resource does not have a base, then null is returned
- * even if the resource does exists remotely (e.g. created by another party).
- */
- public static RemoteFile getLatest(RemoteFolder parent, ICVSFile managed, CVSTag tag, IProgressMonitor monitor) throws CVSException {
- ResourceSyncInfo info = managed.getSyncInfo();
- if ((info == null) || info.isAdded()) {
- // Either the file is unmanaged or has just been added (i.e. doesn't necessarily have a remote)
- return null;
- }
-
- // ensure that the entry line has the tag in it. Or else status will return
- // the latest from the branch of the local resource.
- if(tag!=null) {
- MutableResourceSyncInfo newInfo = info.cloneMutable();
- newInfo.setTag(tag);
- info = newInfo;
- }
-
- // initialize with new sync info from the local resource, this info will
- // be updated when updateRevision is called.
- RemoteFile file = new RemoteFile(parent, info);
-
- // use the contents of the file on disk so that the server can calculate the relative
- // sync state. This is a trick to allow the server to calculate sync state for us.
- InputStream is = managed.getContents();
- file.setContents(is, ICVSFile.UPDATED, false, Policy.monitorFor(null));
-
- parent.setChildren(new ICVSRemoteResource[] {file});
- if( ! file.updateRevision(tag, monitor)) {
- // If updateRevision returns false then the resource no longer exists remotely
- return null;
- }
-
- // forget local contents. Remote contents will be fetched the next time
- // the returned handle is used.
- file.clearContents();
-
- // If the revision changed, clear the contents of the original revision in case contents where cached
- if ( ! info.getRevision().equals(file.getRevision())) {
- RemoteFile originalRevision = new RemoteFile(parent, info);
- originalRevision.clearContents();
- }
- return file;
- }
-
- /**
- * Forget the contents associated with this remote handle.
- */
- public void clearContents() {
- contents = null;
- try {
- File ioFile = CVSProviderPlugin.getPlugin().getCacheFileFor(getCacheRelativePath());
- if (ioFile.exists()) {
- ioFile.delete();
- }
- } catch (IOException e) {
- CVSProviderPlugin.log(CVSException.wrapException(e).getStatus());
- }
- }
/**
* Constructor for RemoteFile that should be used when nothing is know about the
@@ -194,28 +130,15 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
public InputStream getContents(IProgressMonitor monitor) throws CVSException {
if (contents == null) {
// First, check to see if there's a cached contents for the file
- try {
- try {
- File ioFile = CVSProviderPlugin.getPlugin().getCacheFileFor(getCacheRelativePath());
- if (ioFile.exists()) {
- return new BufferedInputStream(new FileInputStream(ioFile));
- }
- } catch (IOException e) {
- // Try to purge the cache and continue
- File ioFile = CVSProviderPlugin.getPlugin().getCacheFileFor(getCacheRelativePath());
- if (ioFile.exists()) {
- ioFile.delete();
- }
- }
- } catch (IOException e) {
- // We will end up here if we couldn't read or delete the cache file
- throw new CVSException(new CVSStatus(IStatus.ERROR, 0, Policy.bind("RemoteFile.errorRetrievingFromCache", e.getMessage()), e));//$NON-NLS-1$
+ InputStream cached = getCachedContents();
+ if (cached != null) {
+ return cached;
}
+ // We need to fetch the contents from the server
monitor.beginTask(Policy.bind("RemoteFile.getContents"), 100);//$NON-NLS-1$
Session.run(getRepository(), parent, false, new ICVSRunnable() {
public void run(IProgressMonitor monitor) throws CVSException {
- monitor.beginTask(null, 100);
IStatus status = Command.UPDATE.execute(
Command.NO_GLOBAL_OPTIONS,
new LocalOption[] {
@@ -223,16 +146,7 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
Update.IGNORE_LOCAL_CHANGES },
new ICVSResource[] { RemoteFile.this },
null,
- Policy.subMonitorFor(monitor, 90));
- if (status.getCode() != CVSStatus.SERVER_ERROR) {
- try {
- getLogEntry(Policy.subMonitorFor(monitor, 10));
- } catch (CVSException e) {
- // Ignore the status of the log entry fetch.
- // If it fails, the entry will still be null
- }
- }
- monitor.done();
+ monitor);
if (status.getCode() == CVSStatus.SERVER_ERROR) {
throw new CVSServerException(status);
}
@@ -243,16 +157,11 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
// than we can assume that the remote file has no contents.
if (contents == null) {
// The above is true unless there is a cache file
- try {
- File ioFile = CVSProviderPlugin.getPlugin().getCacheFileFor(getCacheRelativePath());
- if (ioFile.exists()) {
- return new BufferedInputStream(new FileInputStream(ioFile));
- } else {
- contents = new byte[0];
- }
- } catch (IOException e) {
- // Something is wrong with the cached file so signal an error.
- throw new CVSException(new CVSStatus(IStatus.ERROR, 0, Policy.bind("RemoteFile.errorRetrievingFromCache", e.getMessage()), e));//$NON-NLS-1$
+ cached = getCachedContents();
+ if (cached != null) {
+ return cached;
+ } else {
+ contents = new byte[0];
}
}
}
@@ -339,30 +248,34 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
return file;
}
- /**
- * @see IManagedFile#getSize()
+ /**
+ * @see ICVSFile#getSize()
*/
public long getSize() {
+ if (contents == null) {
+ try {
+ File ioFile = getCacheFile();
+ if (ioFile.exists()) {
+ return ioFile.length();
+ }
+ } catch (IOException e) {
+ // Try to purge the cache and continue
+ try {
+ clearCachedContents();
+ } catch (IOException e2) {
+ }
+ CVSProviderPlugin.log(CVSException.wrapException(e).getStatus());
+ }
+ }
return contents == null ? 0 : contents.length;
}
/**
- * @see IManagedFile#getFileInfo()
+ * @see ICVSFile#getSyncInfo()
*/
public ResourceSyncInfo getSyncInfo() {
return info;
}
-
- /**
- * @see ICVSResource#getRelativePath(ICVSFolder)
- */
- public String getRelativePath(ICVSFolder ancestor) throws CVSException {
- String result = parent.getRelativePath(ancestor);
- if (result.length() == 0)
- return getName();
- else
- return result + Session.SERVER_SEPARATOR + getName();
- }
/**
* @see ICVSResource#getRemoteLocation(ICVSFolder)
@@ -407,13 +320,9 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
public InputStream getContents() throws CVSException {
if (contents == null) {
// Check for cached contents for the file
- try {
- File ioFile = CVSProviderPlugin.getPlugin().getCacheFileFor(getCacheRelativePath());
- if (ioFile.exists()) {
- return new BufferedInputStream(new FileInputStream(ioFile));
- }
- } catch (IOException e) {
- throw new CVSException(new CVSStatus(IStatus.ERROR, 0, Policy.bind("RemoteFile.errorRetrievingFromCache", e.getMessage()), e));//$NON-NLS-1$
+ InputStream cached = getCachedContents();
+ if (cached != null) {
+ return cached;
}
}
return new ByteArrayInputStream(contents == null ? new byte[0] : contents);
@@ -434,16 +343,9 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
// Detect when the file is getting too big to keep in memory
// and switch to a caching strategy for the contents of the file
if (out == byteStream && byteStream.size() > CACHING_THRESHOLD) {
- // Get the cache file to write to
- File ioFile = CVSProviderPlugin.getPlugin().getCacheFileFor(getCacheRelativePath());
- if ( ! ioFile.getParentFile().exists()) {
- ioFile.getParentFile().mkdirs();
- }
// Switch streams
byteStream.close();
- out = new BufferedOutputStream(new FileOutputStream(ioFile));
- // Write what we've read so far
- out.write(byteStream.toByteArray());
+ out = switchToCacheOutputStream(byteStream);
// Continue looping until the whole file is read
}
}
@@ -453,17 +355,16 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
} catch (IOException e) {
// Make sure we don't leave the cache file around as it may not have the right contents
if (byteStream != out) {
- File ioFile = CVSProviderPlugin.getPlugin().getCacheFileFor(getCacheRelativePath());
- if (ioFile.exists()) {
- ioFile.delete();
- }
+ clearCachedContents();
}
throw e;
}
- // Set the contents if we didn't cahce them
+ // Set the contents if we didn't cache them to disk
if (out == byteStream) {
contents = byteStream.toByteArray();
+ } else {
+ contents = null;
}
} finally {
stream.close();
@@ -565,4 +466,51 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
path = path.append(getName() + ' ' + getRevision());
return path.toString();
}
+
+ private File getCacheFile() throws IOException {
+ return CVSProviderPlugin.getPlugin().getCacheFileFor(getCacheRelativePath());
+ }
+
+ private void clearCachedContents() throws IOException {
+ try {
+ File ioFile = getCacheFile();
+ if (ioFile.exists()) {
+ ioFile.delete();
+ }
+ } catch (IOException e) {
+ CVSProviderPlugin.log(CVSException.wrapException(e).getStatus());
+ }
+ }
+
+ private InputStream getCachedContents() throws CVSException {
+ try {
+ try {
+ File ioFile = getCacheFile();
+ if (ioFile.exists()) {
+ return new BufferedInputStream(new FileInputStream(ioFile));
+ }
+ } catch (IOException e) {
+ // Try to purge the cache and continue
+ clearCachedContents();
+ throw e;
+ }
+ } catch (IOException e) {
+ // We will end up here if we couldn't read or delete the cache file
+ throw new CVSException(new CVSStatus(IStatus.ERROR, 0, Policy.bind("RemoteFile.errorRetrievingFromCache", e.getMessage()), e));//$NON-NLS-1$
+ }
+ return null;
+ }
+
+ private OutputStream switchToCacheOutputStream(ByteArrayOutputStream byteStream) throws IOException {
+ // Get the cache file and make sure it's parent exists
+ File ioFile = getCacheFile();
+ if ( ! ioFile.getParentFile().exists()) {
+ ioFile.getParentFile().mkdirs();
+ }
+ // Switch streams
+ OutputStream out = new BufferedOutputStream(new FileOutputStream(ioFile));
+ // Write what we've read so far
+ out.write(byteStream.toByteArray());
+ return out;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
index ebae8e5ec..865b45b11 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFolder.java
@@ -459,13 +459,7 @@ public class RemoteFolder extends RemoteResource implements ICVSRemoteFolder, IC
if (parent == null) {
throw new CVSException(Policy.bind("RemoteFolder.invalidChild", getName(), ancestor.getName())); //$NON-NLS-1$
}
- // Append the receivers name to the parents path relative to the ancestor
- String parentPath = parent.getRelativePath(ancestor);
- if (parentPath.equals(Session.CURRENT_LOCAL_FOLDER) || parentPath.length() == 0) {
- return getName();
- } else {
- return Util.appendPath(parentPath, getName());
- }
+ return super.getRelativePath(ancestor);
}
public ICVSRepositoryLocation getRepository() {
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 cf380bb36..2ff1dc2f0 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
@@ -154,6 +154,11 @@ public class RemoteFolderTreeBuilder {
return builder.buildTree(monitor);
}
+ public static RemoteFile buildRemoteTree(CVSRepositoryLocation repository, ICVSFile file, CVSTag tag, IProgressMonitor monitor) throws CVSException {
+ RemoteFolderTreeBuilder builder = new RemoteFolderTreeBuilder(repository, file.getParent(), tag);
+ return builder.buildTree(file, monitor);
+ }
+
private RemoteFolderTree buildTree(IProgressMonitor monitor) throws CVSException {
// Make sure that the cvs commands are not quiet during this operations
@@ -168,7 +173,7 @@ public class RemoteFolderTreeBuilder {
session.open(Policy.subMonitorFor(monitor, 10));
try {
Policy.checkCanceled(monitor);
- fetchDelta(session, Policy.subMonitorFor(monitor, 50));
+ fetchDelta(session, Session.CURRENT_LOCAL_FOLDER, Policy.subMonitorFor(monitor, 50));
if (projectDoesNotExist) {
return null;
}
@@ -227,6 +232,62 @@ public class RemoteFolderTreeBuilder {
}
}
+ private RemoteFile buildTree(ICVSFile file, IProgressMonitor monitor) throws CVSException {
+ QuietOption quietness = CVSProviderPlugin.getPlugin().getQuietness();
+ try {
+ CVSProviderPlugin.getPlugin().setQuietness(Command.VERBOSE);
+
+ monitor.beginTask(null, 100);
+
+ // Query the server to see if there is a delta available
+ Policy.checkCanceled(monitor);
+ Session session = new Session(repository, root, false);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ Policy.checkCanceled(monitor);
+ fetchDelta(session, file.getName(), Policy.subMonitorFor(monitor, 50));
+ if (projectDoesNotExist) {
+ return null;
+ }
+ } finally {
+ session.close();
+ }
+ // Create a parent for the remote resource
+ remoteRoot =
+ new RemoteFolderTree(null, root.getName(), repository,
+ new Path(root.getFolderSyncInfo().getRepository()),
+ tagForRemoteFolder(root, tag));
+ // Create the remote resource (using the delta if there is one)
+ RemoteFile remoteFile;
+ Map deltas = (Map)fileDeltas.get(Path.EMPTY);
+ if (deltas == null || deltas.isEmpty()) {
+ remoteFile = new RemoteFile(remoteRoot, file.getSyncInfo());
+ } else {
+ DeltaNode d = (DeltaNode)deltas.get(file.getName());
+ remoteFile = new RemoteFile(remoteRoot, d.getSyncState(), file.getName(), tagForRemoteFolder(remoteRoot, tag));
+ }
+ // Add the resource to its parent
+ remoteRoot.setChildren(new ICVSRemoteResource[] {remoteFile});
+ // If there was a delta, ftech the new revision
+ if (!changedFiles.isEmpty()) {
+ // Add the remote folder to the remote folder lookup table (used to update file revisions)
+ remoteFolderTable.put(new Path(remoteRoot.getFolderSyncInfo().getRemoteLocation()), remoteRoot);
+ session = new Session(repository, remoteRoot, false);
+ session.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ fetchFileRevisions(session, (String[])changedFiles.toArray(new String[changedFiles.size()]), Policy.subMonitorFor(monitor, 20));
+ } finally {
+ session.close();
+ }
+ }
+ return remoteFile;
+
+ } finally {
+ CVSProviderPlugin.getPlugin().setQuietness(quietness);
+ monitor.done();
+ }
+ }
+
/*
* Build the base remote tree from the local tree.
*
@@ -426,7 +487,7 @@ public class RemoteFolderTreeBuilder {
*
* Returns the list of changed files
*/
- private List fetchDelta(Session session, final IProgressMonitor monitor) throws CVSException {
+ private List fetchDelta(Session session, String argument, final IProgressMonitor monitor) throws CVSException {
// Create an listener that will accumulate new and removed files and folders
final List newChildDirectories = new ArrayList();
@@ -486,7 +547,7 @@ public class RemoteFolderTreeBuilder {
IStatus status = Command.UPDATE.execute(session,
new GlobalOption[] { Command.DO_NOT_CHANGE },
updateLocalOptions,
- new String[] { Session.CURRENT_LOCAL_FOLDER },
+ new String[] { argument },
new UpdateListener(listener),
monitor);
return changedFiles;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
index 430e3b10b..fee58046f 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java
@@ -42,6 +42,13 @@ public abstract class RemoteResource extends PlatformObject implements ICVSRemot
}
/*
+ * @see ICVSResource#getRelativePath(ICVSFolder)
+ */
+ public String getRelativePath(ICVSFolder ancestor) throws CVSException {
+ return Util.appendPath(parent.getRelativePath(ancestor), getName());
+ }
+
+ /*
* @see ICVSRemoteResource#getParent()
*/
public ICVSRemoteResource getRemoteParent() {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingInputStream.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingInputStream.java
index fdbf3d92d..3ba903905 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingInputStream.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingInputStream.java
@@ -17,6 +17,8 @@ import java.io.InterruptedIOException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.Policy;
/**
@@ -58,15 +60,23 @@ public class PollingInputStream extends FilterInputStream {
*/
public void close() throws IOException {
int attempts = 0;
- for (;;) {
- try {
- in.close();
- return;
- } catch (InterruptedIOException e) {
- if (monitor.isCanceled()) throw new OperationCanceledException();
- if (++attempts == numAttempts)
- throw new InterruptedIOException(Policy.bind("PollingInputStream.closeTimeout")); //$NON-NLS-1$
- if (DEBUG) System.out.println("close retry=" + attempts); //$NON-NLS-1$
+ try {
+ readPendingInput();
+ } catch (IOException e) {
+ // We shouldn't get an exception when we're getting the available input.
+ // If we do, just log it so we can close.
+ CVSProviderPlugin.log(CVSException.wrapException(e).getStatus());
+ } finally {
+ for (;;) {
+ try {
+ in.close();
+ return;
+ } catch (InterruptedIOException e) {
+ if (monitor.isCanceled()) throw new OperationCanceledException();
+ if (++attempts == numAttempts)
+ throw new InterruptedIOException(Policy.bind("PollingInputStream.closeTimeout")); //$NON-NLS-1$
+ if (DEBUG) System.out.println("close retry=" + attempts); //$NON-NLS-1$
+ }
}
}
}
@@ -135,4 +145,18 @@ public class PollingInputStream extends FilterInputStream {
}
}
}
+
+ /**
+ * Reads any pending input from the input stream so that
+ * the stream can savely be closed.
+ */
+ protected void readPendingInput() throws IOException {
+ byte[] buffer= new byte[2048];
+ while (true) {
+ int available = in.available();
+ if (available < 1) break;
+ if (available > buffer.length) available = buffer.length;
+ if (in.read(buffer, 0, available) < 1) break;
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingOutputStream.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingOutputStream.java
index 0e6385b8b..a486d4bd2 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingOutputStream.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/PollingOutputStream.java
@@ -143,7 +143,7 @@ public class PollingOutputStream extends FilterOutputStream {
public void close() throws IOException {
int attempts = numAttempts - 1; // fail fast if flush() does times out
try {
- flush();
+ out.flush();
attempts = 0;
} finally {
for (;;) {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/SizeConstrainedInputStream.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/SizeConstrainedInputStream.java
index 54489979f..5cafd3047 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/SizeConstrainedInputStream.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/streams/SizeConstrainedInputStream.java
@@ -15,6 +15,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
+import org.eclipse.core.runtime.OperationCanceledException;
+
/**
* Simulates a stream that represents only a portion of the underlying stream.
* Will report EOF when this portion has been fully read and prevent further reads.
@@ -52,6 +54,10 @@ public class SizeConstrainedInputStream extends FilterInputStream {
if (discardOnClose) {
while (bytesRemaining != 0 && skip(bytesRemaining) != 0);
}
+ } catch (OperationCanceledException e) {
+ // The receiver is likely wrapping a PollingInputStream which could throw
+ // an OperationCanceledException on a skip.
+ // Since we're closing, just ignore the cancel and let the caller check the monitor
} finally {
bytesRemaining = 0;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
index af1a875e1..adc9605d8 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java
@@ -70,6 +70,14 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
files[i].accept(this);
}
}
+ // Also delete ignored child files that start with .#
+ ICVSResource[] ignoredFiles = folder.members(ICVSFolder.FILE_MEMBERS | ICVSFolder.IGNORED_MEMBERS);
+ for (int i = 0; i < ignoredFiles.length; i++) {
+ ICVSResource cvsResource = ignoredFiles[i];
+ if (cvsResource.getName().startsWith(".#")) {
+ cvsResource.delete();
+ }
+ }
monitor.worked(1);
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
index cd99f83d6..46deb13ea 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
@@ -51,7 +51,9 @@ public class Util {
* Append the prefix and suffix to form a valid CVS path.
*/
public static String appendPath(String prefix, String suffix) {
- if (prefix.endsWith(Session.SERVER_SEPARATOR)) {
+ if (prefix.length() == 0 || prefix.equals(Session.CURRENT_LOCAL_FOLDER)) {
+ return suffix;
+ } else if (prefix.endsWith(Session.SERVER_SEPARATOR)) {
if (suffix.startsWith(Session.SERVER_SEPARATOR))
return prefix + suffix.substring(1);
else
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index d42daa004..1dfc8f924 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -2,7 +2,7 @@
<plugin
id="org.eclipse.team.cvs.ui"
name="%pluginName"
- version="2.0.0"
+ version="1.9.0"
provider-name="Object Technology International, Inc."
class="org.eclipse.team.internal.ccvs.ui.CVSUIPlugin">
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
index 3bd5a6c85..6ff815c24 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareEditorInput.java
@@ -46,8 +46,8 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
/**
- * A compare input for performing naive comparisons between
- * resources and resource editions.
+ * A compare input for comparing remote resources. Use <code>CVSLocalCompareInput</code>
+ * when comparing resources in the workspace to remote resources.
*/
public class CVSCompareEditorInput extends CompareEditorInput {
private ITypedElement left;
@@ -59,53 +59,17 @@ public class CVSCompareEditorInput extends CompareEditorInput {
private static final int NODE_NOT_EQUAL = 1;
private static final int NODE_UNKNOWN = 2;
- class ResourceDiffNode extends DiffNode {
- public ResourceDiffNode(IDiffContainer parent, int kind, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
- super(parent, kind, ancestor, left, right);
- }
- /*
- * @see ICompareInput#copy(boolean)
- */
- public void copy(boolean leftToRight) {
- if (leftToRight) return;
- ITypedElement right = getRight();
- ITypedElement left = getLeft();
- if (left == null) {
- // Addition
- ResourceDiffNode parent = (ResourceDiffNode)getParent();
- IContainer parentResource = (IContainer)((CVSResourceNode)parent.getLeft()).getResource();
- IFile resource = parentResource.getFile(new Path(right.getName()));
- try {
- resource.create(new ByteArrayInputStream(new byte[0]), false, null);
- } catch (CoreException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- left = new CVSResourceNode(resource);
- setLeft(left);
- } else {
- // Deletion
- try {
- ((IFile)((CVSResourceNode)left).getResource()).delete(false, true, null);
- } catch (CoreException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- setLeft(null);
- }
- super.copy(leftToRight);
- }
- };
-
/**
* Creates a new CVSCompareEditorInput.
*/
- public CVSCompareEditorInput(ITypedElement left, ITypedElement right) {
+ public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right) {
this(left, right, null);
}
/**
* Creates a new CVSCompareEditorInput.
*/
- public CVSCompareEditorInput(ITypedElement left, ITypedElement right, ITypedElement ancestor) {
+ public CVSCompareEditorInput(ResourceEditionNode left, ResourceEditionNode right, ResourceEditionNode ancestor) {
super(new CompareConfiguration());
this.left = left;
this.right = right;
@@ -113,19 +77,9 @@ public class CVSCompareEditorInput extends CompareEditorInput {
}
/**
- * Overridden to create the CVSDiffTreeViewer to have the proper popup actions
- */
- //public Viewer createDiffViewer(Composite parent) {
- // return new CVSDiffTreeViewer(parent, this);
- //}
-
- /**
* Returns the label for the given input element.
*/
private String getLabel(ITypedElement element) {
- if (element instanceof ResourceNode) {
- return Policy.bind("CVSCompareEditorInput.workspace", element.getName()); //$NON-NLS-1$
- }
if (element instanceof ResourceEditionNode) {
ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
ICVSResource resource = (ICVSResource)edition;
@@ -161,9 +115,6 @@ public class CVSCompareEditorInput extends CompareEditorInput {
* Returns the label for the given input element.
*/
private String getVersionLabel(ITypedElement element) {
- if (element instanceof ResourceNode) {
- return Policy.bind("CVSCompareEditorInput.workspaceLabel"); //$NON-NLS-1$
- }
if (element instanceof ResourceEditionNode) {
ICVSRemoteResource edition = ((ResourceEditionNode)element).getRemoteResource();
ICVSResource resource = (ICVSResource)edition;
@@ -260,25 +211,6 @@ public class CVSCompareEditorInput extends CompareEditorInput {
ITypedElement right = this.right;
ITypedElement ancestor = this.ancestor;
- if (selection.size() == 1) {
- Object s = selection.getFirstElement();
- if (s instanceof ResourceDiffNode) {
- ResourceDiffNode node = (ResourceDiffNode)s;
- left = node.getLeft();
- right = node.getRight();
- ancestor = node.getAncestor();
- if (left == null) {
- cc.setLeftLabel(Policy.bind("CVSCompareEditorInput.noWorkspaceFile")); //$NON-NLS-1$
- cc.setLeftImage(right.getImage());
- }
- if (right == null) {
- cc.setRightLabel(Policy.bind("CVSCompareEditorInput.noRepositoryFile")); //$NON-NLS-1$
- cc.setRightImage(left.getImage());
- }
- if (ancestor == null) ancestor = this.ancestor;
- }
- }
-
if (left != null) {
cc.setLeftLabel(getLabel(left));
cc.setLeftImage(left.getImage());
@@ -342,11 +274,7 @@ public class CVSCompareEditorInput extends CompareEditorInput {
return null;
}
protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
- if (CVSCompareEditorInput.this.left instanceof CVSResourceNode) {
- return new ResourceDiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
- } else {
- return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
- }
+ return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
}
};
@@ -385,22 +313,10 @@ public class CVSCompareEditorInput extends CompareEditorInput {
* NODE_UNKNOWN if comparison was not possible.
*/
protected int teamEqual(Object left, Object right) {
-
// calculate the type for the left contribution
ICVSRemoteResource leftEdition = null;
if (left instanceof ResourceEditionNode) {
leftEdition = ((ResourceEditionNode)left).getRemoteResource();
- } else if (left instanceof ResourceNode) {
- IResource resource = ((ResourceNode)left).getResource();
- try {
- ICVSResource element = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (resource.getType() == IResource.FILE) {
- if (((ICVSFile) element).isDirty()) return NODE_NOT_EQUAL;
- }
- leftEdition = CVSWorkspaceRoot.getRemoteResourceFor(resource);
- } catch(CVSException e) {
- return NODE_UNKNOWN;
- }
}
// calculate the type for the right contribution
@@ -451,6 +367,7 @@ public class CVSCompareEditorInput extends CompareEditorInput {
private boolean considerContentIfRevisionOrPathDiffers() {
return CVSUIPlugin.getPlugin().getPreferenceStore().getBoolean(ICVSUIConstants.PREF_CONSIDER_CONTENTS);
}
+
public Viewer createDiffViewer(Composite parent) {
Viewer viewer = super.createDiffViewer(parent);
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java
index 5493a75a8..a31e9ec78 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSRepositoryPropertiesPage.java
@@ -210,6 +210,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
info.setPassword(passwordText.getText());
}
final String type = methodType.getText();
+ final String password = passwordText.getText();
final boolean[] result = new boolean[] { false };
try {
new ProgressMonitorDialog(getShell()).run(true, false, new IRunnableWithProgress() {
@@ -218,7 +219,7 @@ public class CVSRepositoryPropertiesPage extends PropertyPage {
// Check if the password was the only thing to change.
if (passwordChanged && !connectionInfoChanged) {
CVSRepositoryLocation oldLocation = (CVSRepositoryLocation)location;
- oldLocation.setPassword(passwordText.getText());
+ oldLocation.setPassword(password);
oldLocation.updateCache();
result[0] = true;
return;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java
index 4de75483a..e0ccbd9b1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoriesView.java
@@ -14,7 +14,9 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.wizard.WizardDialog;
@@ -123,9 +125,23 @@ public class RepositoriesView extends ViewPart {
}
};
- // Properties (popup)
+ // Properties
propertiesAction = new PropertyDialogAction(shell, viewer);
-
+ getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PROPERTIES, propertiesAction);
+ IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+ if (selection.size() == 1 && selection.getFirstElement() instanceof ICVSRepositoryLocation) {
+ propertiesAction.setEnabled(true);
+ } else {
+ propertiesAction.setEnabled(false);
+ }
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection ss = (IStructuredSelection)event.getSelection();
+ boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof ICVSRepositoryLocation;
+ propertiesAction.setEnabled(enabled);
+ }
+ });
+
// Create the popup menu
MenuManager menuMgr = new MenuManager();
Tree tree = viewer.getTree();
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
index a894c1bd3..6ad3d6c6e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
@@ -74,7 +74,6 @@ public class CompareWithRemoteAction extends CompareWithTagAction {
protected boolean isEnabled() {
IResource[] resources = getSelectedResources();
- // allow operation for homegeneous multiple selections
if(resources.length>0) {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
index b1a169731..e6012a137 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
@@ -43,7 +43,6 @@ public class CompareWithTagAction extends TeamAction {
protected boolean isEnabled() {
IResource[] resources = getSelectedResources();
- // allow operation for homegeneous multiple selections
if(resources.length>0) {
for (int i = 0; i < resources.length; i++) {
IResource resource = resources[i];
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
index 5481d6870..a532cc05f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/MergeEditorInput.java
@@ -19,15 +19,16 @@ import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.core.resources.RemoteFile;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
+import org.eclipse.team.ui.sync.MergeResource;
import org.eclipse.team.ui.sync.SyncView;
+import org.eclipse.team.ui.sync.TeamFile;
public class MergeEditorInput extends CVSSyncCompareInput {
CVSTag start;
@@ -116,5 +117,23 @@ public class MergeEditorInput extends CVSSyncCompareInput {
return result[0];
}
+
+ /*
+ * Override collectResourceChanges to only determine the true sync state for incomming changes
+ */
+ protected IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) {
+ if ( ! tree.isContainer()) {
+ CVSRemoteSyncElement cvsTree = (CVSRemoteSyncElement)tree;
+ RemoteFile base = (RemoteFile)cvsTree.getBase();
+ RemoteFile remote = (RemoteFile)cvsTree.getRemote();
+ if (base != null && remote != null && base.getRevision().equals(remote.getRevision())) {
+ // If the base and remote are the same, we don't have an incomming change
+ MergeResource mergeResource = new MergeResource(tree);
+ TeamFile file = new TeamFile(parent, mergeResource, IRemoteSyncElement.IN_SYNC, getShell());
+ return file;
+ }
+ }
+ return super.collectResourceChanges(parent, tree, pm);
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java
index 517811da3..d2ec1aeef 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/merge/UpdateMergeAction.java
@@ -24,6 +24,7 @@ import org.eclipse.team.core.sync.RemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
+import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
@@ -101,10 +102,23 @@ public class UpdateMergeAction extends UpdateSyncAction {
private void makeRemoteLocal(CVSRemoteSyncElement element, IProgressMonitor monitor) throws CVSException {
IRemoteResource remote = element.getRemote();
- IResource local = element.getLocal();
+ final IResource local = element.getLocal();
try {
if(remote==null) {
- local.delete(false, monitor);
+ // Need a runnable so that move/delete hook is disabled
+ final CoreException[] exception = new CoreException[] { null };
+ CVSWorkspaceRoot.getCVSFolderFor(local.getParent()).run(new ICVSRunnable() {
+ public void run(IProgressMonitor monitor) throws CVSException {
+ try {
+ local.delete(false, monitor);
+ } catch(CoreException e) {
+ exception[0] = e;
+ }
+ }
+ }, monitor);
+ if (exception[0] != null) {
+ throw exception[0];
+ }
} else {
if(remote.isContainer()) {
if(!local.exists()) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java
index 8e6c0afb1..fc48fd54f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CommitSyncAction.java
@@ -13,6 +13,7 @@ import java.util.Vector;
import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -25,7 +26,10 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.IRemoteSyncElement;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
+import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
@@ -175,6 +179,19 @@ public class CommitSyncAction extends MergeAction {
}
}
+ // Reset the timestamps for any files that were not committed
+ // because their contents match that of the server
+ for (int i = 0; i < changedResources.length; i++) {
+ IResource resource = changedResources[i];
+ if (resource.getType() == IResource.FILE) {
+ ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)resource);
+ // If the file is still modified after the commit, it probably is a pseudo change
+ if (cvsFile.isModified()) {
+ cvsFile.setTimeStamp(cvsFile.getSyncInfo().getTimeStamp());
+ }
+ }
+ }
+
} catch (final TeamException e) {
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
diff --git a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html
index 311279079..807b2ff6c 100644
--- a/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html
+++ b/bundles/org.eclipse.team.ui/doc/org_eclipse_team_ui.html
@@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Team Core Extension Points</title>
+ <title>Team UI Extension Points</title>
</head>
<body link="#0000FF" vlink="#800080">
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
index efc8bfa3d..57634d3a1 100644
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ b/bundles/org.eclipse.team.ui/plugin.xml
@@ -3,7 +3,7 @@
<plugin
id="org.eclipse.team.ui"
name="%pluginName"
- version="2.0.0"
+ version="1.9.0"
provider-name="Object Technology International, Inc."
class="org.eclipse.team.ui.TeamUIPlugin">
<requires>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java
index 22efa303c..d873642ac 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ExportProjectSetMainPage.java
@@ -82,6 +82,7 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
} else {
selectedProjects.remove(project);
}
+ updateEnablement();
}
});
createLabel(composite, Policy.bind("ExportProjectSetMainPage.Project_Set_File_Name__3")); //$NON-NLS-1$
@@ -145,8 +146,10 @@ public class ExportProjectSetMainPage extends TeamWizardPage {
}
private void updateEnablement() {
boolean complete;
-
- if (file.length() == 0) {
+ if (selectedProjects.size() == 0) {
+ setMessage(null);
+ complete = false;
+ } else if (file.length() == 0) {
setMessage(null);
complete = false;
} else {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java
index f9b606963..7f4323125 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncCompareInput.java
@@ -254,7 +254,7 @@ public abstract class SyncCompareInput extends CompareEditorInput {
* and has enough ticks to allow 1 unit of work per resource in the tree and an additional
* unit for each folder.
*/
- IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) {
+ protected IDiffElement collectResourceChanges(IDiffContainer parent, IRemoteSyncElement tree, IProgressMonitor pm) {
int type = tree.getSyncKind(getSyncGranularity(), Policy.subMonitorFor(pm, 1));
MergeResource mergeResource = new MergeResource(tree);

Back to the top