Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2007-09-11 15:57:17 +0000
committerMichael Valenta2007-09-11 15:57:17 +0000
commit30d3bcaf6ead7b480d9297f28e590d90762ca457 (patch)
treecfd7e0cf76fb398977efecfdd53b153dc9b7bb4b /bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs
parent7a3b0cd5d06f620bcbd6d4241a48f2bdb4beca3a (diff)
downloadeclipse.platform.team-30d3bcaf6ead7b480d9297f28e590d90762ca457.tar.gz
eclipse.platform.team-30d3bcaf6ead7b480d9297f28e590d90762ca457.tar.xz
eclipse.platform.team-30d3bcaf6ead7b480d9297f28e590d90762ca457.zip
Bug 199367 [Actions] Replace With > Version x.yz disabled
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs')
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java26
1 files changed, 22 insertions, 4 deletions
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 d328d7be7..a1f12c027 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
@@ -61,7 +61,7 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
// If deleted, null the sync info so the file will be refetched.
// If we are replacing with the "BASE" tag, the file will not be refetched,
// it is necessary to restore it from history (see bug 150158).
- if (!shouldDeleteModifications()) {
+ if (!shouldDeleteModifications(file)) {
IFile res = (IFile) file.getIResource();
try {
IFileState[] states = res.getHistory(null);
@@ -84,7 +84,7 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
} else {
file.unmanage(null);
}
- } else if (file.isModified(null) && shouldDeleteModifications()) {
+ } else if (file.isModified(null) && shouldDeleteModifications(file)) {
// If the file is modified, delete and unmanage it and allow the
// replace operation to fetch it again. This is required because "update -C"
// will fail for locally modified resources that have been deleted remotely.
@@ -111,8 +111,26 @@ public class PrepareForReplaceVisitor implements ICVSResourceVisitor {
/*
* see bug 150158
*/
- private boolean shouldDeleteModifications() {
- return tag == null || !tag.getName().equals("BASE"); //$NON-NLS-1$
+ private boolean shouldDeleteModifications(ICVSFile file) {
+ return (tag == null && !isStickyRevision(file)) // We don't need to delete sticky files since there can't be conflicting modifications (see bug 199367)
+ || (tag != null && !tag.getName().equals("BASE")); //$NON-NLS-1$
+ }
+
+ private boolean isStickyRevision(ICVSFile file) {
+ try {
+ ResourceSyncInfo info = file.getSyncInfo();
+ if (info != null) {
+ CVSTag tag = info.getTag();
+ if (tag != null) {
+ // The problem with tags on files is that they always have the branch type
+ // so we need to check if the tag is the file's revision
+ return tag.getName().equals(info.getRevision());
+ }
+ }
+ } catch (CVSException e) {
+ CVSProviderPlugin.log(e);
+ }
+ return false;
}
/**

Back to the top