Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-01-24 15:56:15 +0000
committerJean Michel-Lemieux2002-01-24 15:56:15 +0000
commit95e1c82dfcd89eef7852f44ce52a1dbc63a7474a (patch)
tree1417cd74859b3be333305e01fbf188e86aca81fb
parentf624ee672bc1701d8814c050b09bc5e02f2fa624 (diff)
downloadeclipse.platform.team-95e1c82dfcd89eef7852f44ce52a1dbc63a7474a.tar.gz
eclipse.platform.team-95e1c82dfcd89eef7852f44ce52a1dbc63a7474a.tar.xz
eclipse.platform.team-95e1c82dfcd89eef7852f44ce52a1dbc63a7474a.zip
Bug 8052: isOutOfDate and isDirty doesn't work if the base tree is not built from the local sync info.
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java96
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java32
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java46
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteFile.java12
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/RemoteResource.java9
6 files changed, 90 insertions, 107 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index f3dfafb03..51a483755 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -625,7 +625,7 @@ public class CVSTeamProvider implements ITeamNature, ITeamProvider {
throw new TeamException(new CVSStatus(IStatus.ERROR, 0, resource.getProjectRelativePath(), "Error retrieving remote resource tree", e));
}
}
- return new CVSRemoteSyncElement(baseTree==null, resource, baseTree, remote);
+ return new CVSRemoteSyncElement(false, resource, baseTree, remote);
}
public ICVSRemoteResource getRemoteTree(IResource resource, CVSTag tag, IProgressMonitor progress) throws TeamException {
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java
index 2e93b28fb..11c28e1ad 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/ICVSRemoteResource.java
@@ -1,43 +1,53 @@
-package org.eclipse.team.ccvs.core;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.team.core.sync.IRemoteResource;
-
-/**
- * The interface represents a resource that exists in a CVS repository.
- * It purpose is to provide information about the remote resource from
- * the repository.
- *
- * Clients are not expected to implement this interface.
- */
-public interface ICVSRemoteResource extends IRemoteResource {
-
- /**
- * Return the repository
- */
- public ICVSRepositoryLocation getRepository();
-
- /**
- * Returns the parent of this remote resource or <code>null</code> if the
- * remote resource does not have a parent.
- */
- public ICVSRemoteResource getRemoteParent();
-
- /**
- * Does the remote resource represented by this handle exist on the server. This
- * method may contact the server and be long running.
- */
- public boolean exists();
-
- /**
- * Answers the repository relative path of this remote folder.
- */
- public String getRelativePath();
-}
-
+package org.eclipse.team.ccvs.core;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.team.core.sync.IRemoteResource;
+
+/**
+ * The interface represents a resource that exists in a CVS repository.
+ * It purpose is to provide information about the remote resource from
+ * the repository.
+ *
+ * Clients are not expected to implement this interface.
+ */
+public interface ICVSRemoteResource extends IRemoteResource {
+
+ /**
+ * Return the repository
+ */
+ public ICVSRepositoryLocation getRepository();
+
+ /**
+ * Returns the parent of this remote resource or <code>null</code> if the
+ * remote resource does not have a parent.
+ */
+ public ICVSRemoteResource getRemoteParent();
+
+ /**
+ * Does the remote resource represented by this handle exist on the server. This
+ * method may contact the server and be long running.
+ */
+ public boolean exists();
+
+ /**
+ * Answers the repository relative path of this remote folder.
+ */
+ public String getRelativePath();
+
+ /**
+ * Compares two objects for equality; for cvs remote resources, equality is defined in
+ * terms of their handles: same cvs resource type, equal relative paths, and
+ * for files, identical revision numbers. Remote resources are not equal to objects other
+ * than cvs remote resources.
+ *
+ * @param other the other object
+ * @return an indication of whether the objects are equals
+ */
+ public boolean equals(Object other);
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java
index 0ccd53341..7738a0d72 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSLocalSyncElement.java
@@ -54,28 +54,7 @@ public class CVSLocalSyncElement extends LocalSyncElement {
/*
* @see ILocalSyncElement#getBase()
*/
- public IRemoteResource getBase() {
- try {
- if(base == null && cvsResource.isManaged()) {
- if(cvsResource.isFolder()) {
- FolderSyncInfo syncInfo = ((ICVSFolder)cvsResource).getFolderSyncInfo();
- // We need to create an untraversable remote resource for the base
- base = new RemoteFolderTree(null, CVSProvider.getInstance().getRepository(syncInfo.getRoot()), new Path(syncInfo.getRepository()), syncInfo.getTag());
- ((RemoteFolderTree)base).setChildren(new ICVSRemoteResource[0]);
- } else {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- if(!info.isDeleted() || !info.isAdded()) {
- ICVSFolder parentFolder = cvsResource.getParent();
- FolderSyncInfo syncInfo = parentFolder.getFolderSyncInfo();
- RemoteFolder parent = new RemoteFolder(null, CVSProvider.getInstance().getRepository(syncInfo.getRoot()), new Path(syncInfo.getRepository()), syncInfo.getTag());
- base = RemoteFile.getBase(parent, (ICVSFile)cvsResource);
- }
- }
- }
- } catch(CVSException e) {
- TeamPlugin.log(IStatus.ERROR, "CVS error creating the base resource", e);
- return null;
- }
+ public IRemoteResource getBase() {
return base;
}
@@ -90,9 +69,16 @@ public class CVSLocalSyncElement extends LocalSyncElement {
return false;
} else {
try {
- if(cvsResource.getSyncInfo()==null) {
+ ResourceSyncInfo info = cvsResource.getSyncInfo();
+ if(info==null) {
return false;
}
+ if(base!=null) {
+ boolean sameRevisions = ((RemoteFile)base).getRevision().equals(info.getRevision());
+ if(!sameRevisions) {
+ return true;
+ }
+ }
return ((ICVSFile)cvsResource).isDirty();
} catch(CVSException e) {
return true;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
index a3471ad72..b2436992b 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSRemoteSyncElement.java
@@ -7,16 +7,15 @@ package org.eclipse.team.internal.ccvs.core.resources;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.team.ccvs.core.ICVSRemoteFile;
+import org.eclipse.team.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.sync.ILocalSyncElement;
import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.core.sync.RemoteSyncElement;
-import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProvider;
-import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.Policy;
+import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.util.Assert;
public class CVSRemoteSyncElement extends RemoteSyncElement {
@@ -49,41 +48,12 @@ public class CVSRemoteSyncElement extends RemoteSyncElement {
* @see IRemoteSyncElement#isOutOfDate()
*/
public boolean isOutOfDate() {
-
- // XXX gender changes?
- if(isContainer()) {
- return false;
- }
-
- boolean hasBase = false;
-
- ICVSResource cvsResource = localSync.getCVSResource();
- if(cvsResource != null && !cvsResource.isFolder()) {
- try {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- if ((info != null) && !info.isAdded()) {
- hasBase = true;
- }
- } catch(CVSException e) {
- return true;
- }
- }
- boolean hasRemote = remote != null;
-
- if(hasBase && hasRemote) {
- ICVSFile file = (ICVSFile)localSync.getCVSResource();
- try {
- // at this point remote and file can't be null
- Assert.isNotNull(remote);
- Assert.isNotNull(file);
- ResourceSyncInfo info = file.getSyncInfo();
- return ! ((ICVSRemoteFile)remote).getRevision().equalsIgnoreCase(info.getRevision());
- } catch(CVSException e) {
- return true;
- } catch(TeamException e) {
- return true;
- }
- } else if(hasBase && !hasRemote) {
+ IRemoteResource base = getBase();
+ if(base!=null && remote!=null) {
+ ICVSRemoteResource remoteCvs = (ICVSRemoteResource)remote;
+ ICVSRemoteResource baseCvs = (ICVSRemoteResource)base;
+ return ! remoteCvs.equals(baseCvs);
+ } else if(base!=null && remote==null) {
return true;
} else {
return false;
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 ed56e0224..129af60f0 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
@@ -360,5 +360,13 @@ public class RemoteFile extends RemoteResource implements ICVSRemoteFile, ICVSFi
public boolean updateRevision(CVSTag tag, IProgressMonitor monitor) throws CVSException {
return parent.updateRevision(this, tag, monitor);
}
-}
-
+
+ public boolean equals(Object target) {
+ if (this == target)
+ return true;
+ if (!(target instanceof RemoteFile))
+ return false;
+ RemoteFile remote = (RemoteFile) target;
+ return super.equals(target) && remote.getRevision().equals(getRevision());
+ }
+} \ No newline at end of file
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 25b52fffd..21fed0d4f 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
@@ -110,4 +110,13 @@ public abstract class RemoteResource extends PlatformObject implements ICVSRemot
// ensure that clients are not trying to set sync info on remote handles.
Assert.isTrue(false);
}
+
+ public boolean equals(Object target) {
+ if (this == target)
+ return true;
+ if (!(target instanceof RemoteResource))
+ return false;
+ RemoteResource remote = (RemoteResource) target;
+ return remote.isContainer() == isContainer() && remote.getRelativePath().equals(getRelativePath());
+ }
} \ No newline at end of file

Back to the top