Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-04-09 13:45:08 +0000
committerMichael Valenta2002-04-09 13:45:08 +0000
commit951cad94feeceb8fd19ec40c31a3505187e257b0 (patch)
tree2e070f024321ed6a5c0230a8ba2da6026d82d6bb
parente5d7ad7a7acf7763e342bc69bd26f0a284c50c2a (diff)
downloadeclipse.platform.team-951cad94feeceb8fd19ec40c31a3505187e257b0.tar.gz
eclipse.platform.team-951cad94feeceb8fd19ec40c31a3505187e257b0.tar.xz
eclipse.platform.team-951cad94feeceb8fd19ec40c31a3505187e257b0.zip
13039: CVSRemoteFile getContents()/getLogEntry() combination is not feasible
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java74
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java17
5 files changed, 60 insertions, 42 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java
index 1ffc83cbc..c7a79c7f2 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTag.java
@@ -20,6 +20,7 @@ public class CVSTag {
public final static int DATE = 3;
public static final CVSTag DEFAULT = new CVSTag();
+ public static final CVSTag BASE = new CVSTag("BASE", VERSION); //$NON-NLS-1$
protected String name;
protected int type;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java
index ba91c0ff1..b392bcc6b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteFile.java
@@ -26,7 +26,7 @@ public interface ICVSRemoteFile extends ICVSRemoteResource, ICVSFile {
* This method will return null until after the getContents(IProgressMonitor)
* method is called (i.e. the call to getContents also fetches the entry.
*/
- public ILogEntry getLogEntry();
+ public ILogEntry getLogEntry(IProgressMonitor monitor) throws TeamException;
/**
* Get all the log entries of the remote file
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 dc5e21346..74b3143c7 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
@@ -169,18 +169,10 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
new String[] { getName() },
null,
Policy.subMonitorFor(monitor, 80));
- if (status.getCode() != CVSStatus.SERVER_ERROR) {
- IStatus logStatus = Command.LOG.execute(s,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] {
- Command.LOG.makeRevisionOption(info.getRevision())},
- new String[] { getName() },
- new LogListener(this, entries),
- Policy.subMonitorFor(monitor, 10));
- if (logStatus.isMultiStatus()) {
- ((MultiStatus)logStatus).merge(status);
- status = logStatus;
- }
+ if (status.getCode() != CVSStatus.SERVER_ERROR && entry == null) {
+ getLogEntry(s, Policy.subMonitorFor(monitor, 10));
+ // Ignore the status of the log entry fetch.
+ // If it fails, the entry will still be null
}
} finally {
s.close();
@@ -191,13 +183,8 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
}
// If the update succeeded but no contents were retreived from the server
// than we can assume that the remote file has no contents.
- if (contents == null)
+ if (contents == null) {
contents = new byte[0];
-
- if (entries.size() == 1) {
- entry = (ILogEntry)entries.get(0);
- } else {
- // No log entry was fetch for the remote file.
}
}
return new ByteArrayInputStream(contents);
@@ -206,6 +193,50 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
}
}
+ /*
+ * @see ICVSRemoteFile#getLogEntry()
+ */
+ public ILogEntry getLogEntry(IProgressMonitor monitor) throws CVSException {
+ if (entry == null) {
+ monitor.beginTask(null, 100);
+ Session s = new Session(getRepository(), parent, false);
+ s.open(Policy.subMonitorFor(monitor, 10));
+ try {
+ IStatus status = getLogEntry(s, Policy.subMonitorFor(monitor, 90));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
+ }
+ } finally {
+ s.close();
+ monitor.done();
+ }
+ }
+ return entry;
+ }
+
+ /*
+ * Fetch the log entry corresponding to the receivers revision and set the entry
+ * instance variable to the result. If the fecth failed, entry will be null and
+ * the resulting IStatus will contain any errors.
+ */
+ private IStatus getLogEntry(Session session, IProgressMonitor monitor) throws CVSException {
+ List entries = new ArrayList();
+ IStatus status = Command.LOG.execute(session,
+ Command.NO_GLOBAL_OPTIONS,
+ new LocalOption[] {
+ Command.LOG.makeRevisionOption(info.getRevision())},
+ new String[] { getName() },
+ new LogListener(this, entries),
+ Policy.subMonitorFor(monitor, 10));
+ if (entries.size() == 1) {
+ entry = (ILogEntry)entries.get(0);
+ } else {
+ // No log entry was fetch for the remote file.
+ entry = null;
+ }
+ return status;
+ }
+
/**
* @see ICVSRemoteFile#getLogEntries()
*/
@@ -332,13 +363,6 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile {
}
/*
- * @see ICVSRemoteFile#getLogEntry()
- */
- public ILogEntry getLogEntry() {
- return entry;
- }
-
- /*
* @see ICVSFile#setReadOnly()
*/
public void setContents(InputStream stream, int responseType, boolean keepLocalHistory, IProgressMonitor monitor) throws CVSException {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
index 2c8f84410..74419aab4 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSCatchupReleaseViewer.java
@@ -282,12 +282,8 @@ public class CVSCatchupReleaseViewer extends CatchupReleaseViewer {
try {
ICVSRemoteFile remoteFile = (ICVSRemoteFile)remote;
String revision = remoteFile.getRevision();
- ILogEntry logEntry = remoteFile.getLogEntry();
- if (logEntry == null) {
- // Hack: call getContents() so that the log entry is available.
- remoteFile.getContents(new NullProgressMonitor());
- logEntry = remoteFile.getLogEntry();
- }
+ // XXX Should have real progress
+ ILogEntry logEntry = remoteFile.getLogEntry(new NullProgressMonitor());
String author = logEntry.getAuthor();
config.setRightLabel(Policy.bind("CVSCatchupReleaseViewer.repositoryFileRevision", new Object[] {name, revision, author}));
} catch (TeamException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
index 5f7070dbf..f14653089 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
@@ -67,17 +67,14 @@ public class CVSSyncCompareInput extends SyncCompareInput {
if (file.getChangeDirection() != ITeamNode.OUTGOING) {
IRemoteSyncElement element = file.getMergeResource().getSyncElement();
ICVSRemoteFile remoteFile = (ICVSRemoteFile)element.getRemote();
+ ILogEntry logEntry;
if (remoteFile != null) {
- ILogEntry logEntry = remoteFile.getLogEntry();
- if (logEntry == null) {
- // Hack: call getContents() so that the log entry is available.
- try {
- remoteFile.getContents(new NullProgressMonitor());
- } catch (TeamException ex) {
- tree.setToolTipText(null);
- return;
- }
- logEntry = remoteFile.getLogEntry();
+ try {
+ // XXX Should have real progress here
+ logEntry = remoteFile.getLogEntry(new NullProgressMonitor());
+ } catch (TeamException ex) {
+ tree.setToolTipText(null);
+ return;
}
if (logEntry != null) {
String newText = logEntry.getComment();

Back to the top