Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-05-16 14:52:51 -0400
committerMichael Valenta2002-05-16 14:52:51 -0400
commit90062856ee597f4ca008ad7ff3d74257bc207322 (patch)
tree3d0a769103104100b0983edb9aa38b3c93989e2b /bundles/org.eclipse.team.cvs.ui
parent8a2eadaca6a8458fdb2a7aa3edcbe0e290d9723d (diff)
downloadeclipse.platform.team-90062856ee597f4ca008ad7ff3d74257bc207322.tar.gz
eclipse.platform.team-90062856ee597f4ca008ad7ff3d74257bc207322.tar.xz
eclipse.platform.team-90062856ee597f4ca008ad7ff3d74257bc207322.zip
15942: Conflicting addition cannot be committed
15943: Conflicting Folder addition and Add to Version Control leaves conflict
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java43
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java34
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java28
4 files changed, 66 insertions, 63 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java
index c5d40e5f0..a0a244d54 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/AddSyncAction.java
@@ -38,6 +38,8 @@ import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
@@ -67,16 +69,25 @@ public class AddSyncAction extends MergeAction {
}
List additions = new ArrayList();
- for (int i = 0; i < changed.length; i++) {
- int kind = changed[i].getKind();
- // leave the added nodes in the sync view. Their sync state
- // won't change but the decoration should.
- IResource resource = changed[i].getResource();
- if (resource.getType() == resource.FILE) {
- additions.add(resource);
- }
- }
try {
+ for (int i = 0; i < changed.length; i++) {
+ int kind = changed[i].getKind();
+ // leave the added nodes in the sync view. Their sync state
+ // won't change but the decoration should.
+ IResource resource = changed[i].getResource();
+ if ((kind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING) {
+ if (resource.getType() == IResource.FOLDER) {
+ makeInSync(changed[i]);
+ } else {
+ makeAdded(changed[i]);
+ }
+ } else {
+ if (resource.getType() == resource.FILE) {
+ additions.add(resource);
+ }
+ }
+ }
+
RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
if (additions.size() != 0) {
manager.add((IResource[])additions.toArray(new IResource[0]), monitor);
@@ -102,6 +113,19 @@ public class AddSyncAction extends MergeAction {
return syncSet;
}
+
+ protected void makeAdded(ITeamNode changed)
+ throws TeamException, CVSException {
+ // Fake the add locally since add command will fail
+ makeInSync(changed.getParent());
+ CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((TeamFile)changed).getMergeResource().getSyncElement();
+ ICVSResource remote = (ICVSResource)syncElement.getRemote();
+ MutableResourceSyncInfo info = remote.getSyncInfo().cloneMutable();
+ info.setTimeStamp(null);
+ info.setAdded();
+ ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)changed.getResource());
+ cvsFile.setSyncInfo(info);
+ }
/**
* Enabled for folders and files that aren't added.
@@ -119,7 +143,6 @@ public class AddSyncAction extends MergeAction {
* Remove all nodes that aren't files and folders that need to be added.
*/
protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
- set.removeConflictingNodes();
set.removeIncomingNodes();
((CVSSyncSet)set).removeAddedChanges();
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java
index f32a8afd1..bfc8dc0e1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/ForceCommitSyncAction.java
@@ -216,30 +216,6 @@ public class ForceCommitSyncAction extends MergeAction {
return syncSet;
}
-
- protected void makeInSync(IDiffElement parentElement) throws TeamException {
- // Recursively make the parent element (and its parents) in sync.
- // Walk up and find the parents which need to be made in sync too. (For
- // each parent that doesn't already have sync info).
- Vector v = new Vector();
- int parentKind = parentElement.getKind();
- while (((parentKind & Differencer.CHANGE_TYPE_MASK) == Differencer.ADDITION) &&
- ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.INCOMING) ||
- ((parentKind & Differencer.DIRECTION_MASK) == ITeamNode.CONFLICTING)) {
- v.add(0, parentElement);
- parentElement = parentElement.getParent();
- parentKind = parentElement == null ? 0 : parentElement.getKind();
- }
- Iterator parentIt = v.iterator();
- while (parentIt.hasNext()) {
- IDiffElement next = (IDiffElement)parentIt.next();
- if (next instanceof ChangedTeamContainer) {
- CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)next).getMergeResource().getSyncElement();
- // Create the sync info
- syncElement.makeInSync(new NullProgressMonitor());
- }
- }
- }
protected boolean isEnabled(ITeamNode node) {
// The force commit action is enabled only for conflicting and incoming changes
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java
index 3e2396a96..8864367b5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/MergeAction.java
@@ -5,10 +5,11 @@ package org.eclipse.team.internal.ccvs.ui.sync;
* All Rights Reserved.
*/
-import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.structuremergeviewer.Differencer;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
@@ -26,6 +27,7 @@ import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.sync.IRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.resources.CVSRemoteSyncElement;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -314,4 +316,34 @@ abstract class MergeAction extends Action {
// If no matches occured above, we don't have any "real" changes in the given directions
return false;
}
+
+ /**
+ * Recursively make the parent element (and its parents) in sync.
+ * Walk up and find the parents which need to be made in sync too. (For
+ * each parent that doesn't already have sync info).
+ */
+ protected void makeInSync(IDiffElement parentElement) throws TeamException {
+ ArrayList v = new ArrayList();
+ int parentKind = parentElement.getKind();
+ int direction = parentKind & Differencer.DIRECTION_MASK;
+ int change = parentKind & Differencer.CHANGE_TYPE_MASK;
+ while ((change == Differencer.ADDITION) &&
+ ((direction == ITeamNode.INCOMING) || (direction == ITeamNode.CONFLICTING))) {
+ v.add(0, parentElement);
+ parentElement = parentElement.getParent();
+ parentKind = parentElement == null ? 0 : parentElement.getKind();
+ direction = parentKind & Differencer.DIRECTION_MASK;
+ change = parentKind & Differencer.CHANGE_TYPE_MASK;
+ }
+ Iterator parentIt = v.iterator();
+ while (parentIt.hasNext()) {
+ IDiffElement next = (IDiffElement)parentIt.next();
+ if (next instanceof ChangedTeamContainer) {
+ CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)next).getMergeResource().getSyncElement();
+ // Create the sync info
+ syncElement.makeInSync(Policy.monitorFor(null));
+ ((ChangedTeamContainer)next).setKind(IRemoteSyncElement.IN_SYNC);
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
index a1bf776c8..2bb5b0c57 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/UpdateSyncAction.java
@@ -343,34 +343,6 @@ public class UpdateSyncAction extends MergeAction {
protected void runUpdateShallow(ITeamNode[] nodes, RepositoryManager manager, IProgressMonitor monitor) throws TeamException {
manager.update(getIResourcesFrom(nodes), new Command.LocalOption[] { Command.DO_NOT_RECURSE }, false, monitor);
}
-
- protected void makeInSync(IDiffElement parentElement) throws TeamException {
- // Recursively make the parent element (and its parents) in sync.
- // Walk up and find the parents which need to be made in sync too. (For
- // each parent that doesn't already have sync info).
- Vector v = new Vector();
- int parentKind = parentElement.getKind();
- int direction = parentKind & Differencer.DIRECTION_MASK;
- int change = parentKind & Differencer.CHANGE_TYPE_MASK;
- while ((change == Differencer.ADDITION) &&
- ((direction == ITeamNode.INCOMING) || (direction == ITeamNode.CONFLICTING))) {
- v.add(0, parentElement);
- parentElement = parentElement.getParent();
- parentKind = parentElement == null ? 0 : parentElement.getKind();
- direction = parentKind & Differencer.DIRECTION_MASK;
- change = parentKind & Differencer.CHANGE_TYPE_MASK;
- }
- Iterator parentIt = v.iterator();
- while (parentIt.hasNext()) {
- IDiffElement next = (IDiffElement)parentIt.next();
- if (next instanceof ChangedTeamContainer) {
- CVSRemoteSyncElement syncElement = (CVSRemoteSyncElement)((ChangedTeamContainer)next).getMergeResource().getSyncElement();
- // Create the sync info
- syncElement.makeInSync(new NullProgressMonitor());
- ((ChangedTeamContainer)next).setKind(IRemoteSyncElement.IN_SYNC);
- }
- }
- }
protected IResource[] getIResourcesFrom(ITeamNode[] nodes) {
List resources = new ArrayList(nodes.length);

Back to the top