Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-08-05 18:15:13 +0000
committerJean Michel-Lemieux2003-08-05 18:15:13 +0000
commit9d12a6e8a73f727b18f2db040eba1c3684058cf3 (patch)
treed0d992ea674c96e9a6cdac40b02c499d0b0cc081
parent5ec1455fb62e518938e6b2cea77a7462a0fd3684 (diff)
downloadeclipse.platform.team-9d12a6e8a73f727b18f2db040eba1c3684058cf3.tar.gz
eclipse.platform.team-9d12a6e8a73f727b18f2db040eba1c3684058cf3.tar.xz
eclipse.platform.team-9d12a6e8a73f727b18f2db040eba1c3684058cf3.zip
Added explicit override and commit action and change dupdate to not perform the override and update.
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.properties3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java9
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java37
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java12
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java35
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java7
8 files changed, 81 insertions, 35 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.properties b/bundles/org.eclipse.team.cvs.ui/plugin.properties
index f3bd06c43..5578d3cd7 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.properties
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.properties
@@ -175,6 +175,9 @@ CVSWorkspaceSubscriber.update.tooltip=Perform an update on the visible resources
CVSWorkspaceSubscriber.commit.label=&Commit
CVSWorkspaceSubscriber.commit.tooltip=Perform a commit on the visible resources
+CVSWorkspaceSubscriber.overcommit.label=&Override and Commit
+CVSWorkspaceSubscriber.overcommit.tooltip=Perform an override and commit on the visible resources. This will make the remote contents equal to the local.
+
CVSWorkspaceSubscriber.confirmMerged.label=&Mark as Merged
CVSWorkspaceSubscriber.confirmMerged.tooltip=Mark the conflict as merged by upgrading the base to match the remote
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 0df87f679..8994a5754 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -580,6 +580,15 @@
</action>
<action
+ label="%CVSWorkspaceSubscriber.overcommit.label"
+ menubarPath="SubscriberActions"
+ tooltip="%CVSWorkspaceSubscriber.overcommit.tooltip"
+ class="org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndCommitAction"
+ helpContextId="org.eclipse.team.cvs.ui.workspace_subscriber_overcommit_action"
+ id="org.eclipse.team.ccvs.ui.CVSWorkspaceSubscriber.overcommit">
+ </action>
+
+ <action
label="%CVSWorkspaceSubscriber.commit.label"
menubarPath="SubscriberActions"
tooltip="%CVSWorkspaceSubscriber.commit.tooltip"
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
index c5b367f4e..4b398950d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/MergeUpdateAction.java
@@ -43,6 +43,13 @@ import org.eclipse.team.ui.sync.SyncInfoSet;
public class MergeUpdateAction extends SafeUpdateAction {
/* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#getOverwriteLocalChanges()
+ */
+ protected boolean getOverwriteLocalChanges() {
+ return true;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.team.ui.sync.SubscriberAction#getSyncInfoFilter()
*/
protected SyncInfoFilter getSyncInfoFilter() {
@@ -198,5 +205,5 @@ public class MergeUpdateAction extends SafeUpdateAction {
if (!cvsFolder.exists()) {
cvsFolder.mkdir();
}
- }
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
new file mode 100644
index 000000000..4c5832707
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/OverrideAndCommitAction.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui.subscriber;
+
+import org.eclipse.team.ui.sync.SyncInfoSet;
+
+public class OverrideAndCommitAction extends SubscriberCommitAction {
+
+ protected boolean promptForConflictHandling(SyncInfoSet syncSet) {
+ // If there is a conflict in the syncSet, we need to prompt the user before proceeding.
+ if (syncSet.hasConflicts() || syncSet.hasIncomingChanges()) {
+ switch (promptForConflicts(syncSet)) {
+ case 0:
+ // Yes, synchronize conflicts as well
+ break;
+ case 1:
+ // No, only synchronize non-conflicting changes.
+ syncSet.removeConflictingNodes();
+ syncSet.removeIncomingNodes();
+ break;
+ case 2:
+ default:
+ // Cancel
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
index e4cd6d4d9..d2d54e130 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SafeUpdateAction.java
@@ -73,9 +73,11 @@ public abstract class SafeUpdateAction extends CVSSubscriberAction {
});
// Ask the user if a replace should be performed on the remaining nodes
- if (!failedSet.isEmpty() && promptForOverwrite(failedSet)) {
- overwriteUpdate(failedSet, Policy.subMonitorFor(monitor, willFail.length * 100));
- syncSet.addAll(failedSet);
+ if(getOverwriteLocalChanges()) {
+ if (!failedSet.isEmpty() && promptForOverwrite(failedSet)) {
+ overwriteUpdate(failedSet, Policy.subMonitorFor(monitor, willFail.length * 100));
+ syncSet.addAll(failedSet);
+ }
}
updated(syncSet.getResources());
@@ -84,6 +86,10 @@ public abstract class SafeUpdateAction extends CVSSubscriberAction {
}
}
+ protected boolean getOverwriteLocalChanges(){
+ return false;
+ }
+
/**
* Perform a safe update on the resources in the provided set. Any included resources
* that cannot be updated safely wil be added to the skippedFiles list.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
index 61be13a42..6a224ae81 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitAction.java
@@ -30,14 +30,9 @@ import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
import org.eclipse.team.internal.ccvs.ui.sync.ToolTipMessageDialog;
+import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.sync.SyncInfoSet;
-/**
- * @author Administrator
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
public class SubscriberCommitAction extends CVSSubscriberAction {
private String comment;
@@ -51,34 +46,16 @@ public class SubscriberCommitAction extends CVSSubscriberAction {
try {
if (!promptForUnaddedHandling(syncSet)) return null;
} catch (CVSException e) {
- // TODO Could prompt the user with option to continue
- // instead of just continuing
- CVSUIPlugin.log(e);
+ Utils.handle(e);
}
return syncSet;
}
- /**
- * @param syncSet
- * @return
- */
- private boolean promptForConflictHandling(SyncInfoSet syncSet) {
- // If there is a conflict in the syncSet, we need to prompt the user before proceeding.
+ protected boolean promptForConflictHandling(SyncInfoSet syncSet) {
+ // If there is a conflict in the syncSet, remove from sync set.
if (syncSet.hasConflicts() || syncSet.hasIncomingChanges()) {
- switch (promptForConflicts(syncSet)) {
- case 0:
- // Yes, synchronize conflicts as well
- break;
- case 1:
- // No, only synchronize non-conflicting changes.
- syncSet.removeConflictingNodes();
- syncSet.removeIncomingNodes();
- break;
- case 2:
- default:
- // Cancel
- return false;
- }
+ syncSet.removeConflictingNodes();
+ syncSet.removeIncomingNodes();
}
return true;
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
index f76ea0b46..e00269322 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestCommitAction.java
@@ -11,10 +11,10 @@
package org.eclipse.team.tests.ccvs.core.subscriber;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.internal.ccvs.ui.subscriber.SubscriberCommitAction;
+import org.eclipse.team.internal.ccvs.ui.subscriber.OverrideAndCommitAction;
import org.eclipse.team.ui.sync.SyncInfoSet;
-class TestCommitAction extends SubscriberCommitAction {
+class TestCommitAction extends OverrideAndCommitAction {
public IRunnableWithProgress getRunnable(SyncInfoSet syncSet) {
return super.getRunnable(syncSet);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java
index ca9d8a169..33df73130 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/TestWorkspaceUpdateAction.java
@@ -19,6 +19,13 @@ import org.eclipse.team.ui.sync.SyncInfoSet;
class TestWorkspaceUpdateAction extends WorkspaceUpdateAction {
boolean allowOverwrite = false;
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.subscriber.SafeUpdateAction#getOverwriteLocalChanges()
+ */
+ protected boolean getOverwriteLocalChanges() {
+ return allowOverwrite;
+ }
+
public TestWorkspaceUpdateAction(boolean allowOverwrite) {
this.allowOverwrite = allowOverwrite;
}

Back to the top