Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-02-27 21:02:02 +0000
committerMichael Valenta2004-02-27 21:02:02 +0000
commit76fe301033911c92b196fac1420798e0630452ee (patch)
tree9493dab3020343a4a7e92cc999559a62a8fbb7bc
parentf38923761fbae0865f107ecafb9bf257d9450f20 (diff)
downloadeclipse.platform.team-76fe301033911c92b196fac1420798e0630452ee.tar.gz
eclipse.platform.team-76fe301033911c92b196fac1420798e0630452ee.tar.xz
eclipse.platform.team-76fe301033911c92b196fac1420798e0630452ee.zip
50250: CVS sync view becomes out-of-date
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java27
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java19
2 files changed, 29 insertions, 17 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
index 08efcd2fd..cd25ff25e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseFile.java
@@ -125,7 +125,12 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
int state = EclipseSynchronizer.getInstance().getModificationState(getIFile());
if (state != UNKNOWN) {
- return state != CLEAN;
+ boolean dirty = state != CLEAN;
+ // Check to make sure that cached state is the real state.
+ // They can be different if deltas happen in the wrong order.
+ if (dirty == isDirty()) {
+ return dirty;
+ }
}
// nothing cached, need to manually check (and record)
@@ -532,6 +537,26 @@ public class EclipseFile extends EclipseResource implements ICVSFile {
if (parentPath == null) return null;
return parentPath + Session.SERVER_SEPARATOR + getName();
}
+
+ protected boolean isDirty() throws CVSException {
+ boolean dirty;
+ byte[] syncBytes = getSyncBytes();
+ if (syncBytes == null) {
+ dirty = exists();
+ } else {
+ // isMerged() must be called because when a file is updated and merged by the cvs server the timestamps
+ // are equal. Merged files should however be reported as dirty because the user should take action and commit
+ // or review the merged contents.
+ if(ResourceSyncInfo.isAddition(syncBytes) || ResourceSyncInfo.isMerge(syncBytes) || !exists()) {
+ dirty = true;
+ } else {
+ // TODO: non-optimal as ResourceSyncInfo is created each time
+ ResourceSyncInfo info = new ResourceSyncInfo(syncBytes);
+ dirty = !getTimeStamp().equals(info.getTimeStamp());
+ }
+ }
+ return dirty;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
index 92b67693c..436135148 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -1565,7 +1565,7 @@ public class EclipseSynchronizer implements IFlushOperation {
* @param time
* @throws CVSException
*/
- public void setTimeStamp(ICVSFile cvsFile, long time) throws CVSException {
+ public void setTimeStamp(EclipseFile cvsFile, long time) throws CVSException {
ISchedulingRule rule = null;
IFile file = (IFile)cvsFile.getIResource();
try {
@@ -1663,25 +1663,12 @@ public class EclipseSynchronizer implements IFlushOperation {
* @param modificationState
* @return true if the file is dirty
*/
- public boolean setModified(ICVSFile cvsFile, int modificationState) throws CVSException {
+ public boolean setModified(EclipseFile cvsFile, int modificationState) throws CVSException {
try {
beginOperation();
boolean dirty;
if (modificationState == ICVSFile.UNKNOWN) {
- // if there is no sync info and it doesn't exist then it is a phantom we don't care about.
- ResourceSyncInfo info = cvsFile.getSyncInfo();
- if (info == null) {
- dirty = cvsFile.exists();
- } else {
- // isMerged() must be called because when a file is updated and merged by the cvs server the timestamps
- // are equal. Merged files should however be reported as dirty because the user should take action and commit
- // or review the merged contents.
- if(info.isAdded() || info.isMerged() || !cvsFile.exists()) {
- dirty = true;
- } else {
- dirty = !cvsFile.getTimeStamp().equals(info.getTimeStamp());
- }
- }
+ dirty = cvsFile.isDirty();
} else {
dirty = modificationState == ICVSFile.DIRTY;
}

Back to the top