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
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')
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/PrepareForReplaceVisitor.java26
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java23
3 files changed, 23 insertions, 28 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;
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
index e0e05dcc9..abc2cef9a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSHistoryPage.java
@@ -479,7 +479,7 @@ public class CVSHistoryPage extends HistoryPage implements IAdaptable, IHistoryC
}
}
} catch (InvocationTargetException e) {
- CVSException.wrapException(e);
+ throw CVSException.wrapException(e);
} catch (InterruptedException e) {
// Cancelled by user
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
index f2fb0daa6..f6455c8e9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
@@ -15,9 +15,6 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
import org.eclipse.team.internal.ccvs.ui.operations.ReplaceOperation;
@@ -66,26 +63,6 @@ public class ReplaceWithRemoteAction extends WorkspaceTraversalAction {
protected boolean isEnabledForNonExistantResources() {
return true;
}
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForCVSResource(org.eclipse.team.internal.ccvs.core.ICVSResource)
- */
- protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException {
- if (super.isEnabledForCVSResource(cvsResource)) {
- // Don't enable if there are sticky file revisions in the lineup
- if (!cvsResource.isFolder()) {
- ResourceSyncInfo info = cvsResource.getSyncInfo();
- if (info != null && info.getTag() != null) {
- String revision = info.getRevision();
- String tag = info.getTag().getName();
- if (revision.equals(tag)) return false;
- }
- }
- return true;
- } else {
- return false;
- }
- }
/*
* Update the text label for the action based on the tags in the

Back to the top