Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2004-03-26 21:39:09 +0000
committerMichael Valenta2004-03-26 21:39:09 +0000
commit77091a8df259ac6d96b46ffa8e48c33bbca40a90 (patch)
tree4d61500c3d81e2450fd611d9f12b5cdfdf4373eb
parenta2bad9680dbcbd37428796c41871a155adbb5294 (diff)
downloadeclipse.platform.team-77091a8df259ac6d96b46ffa8e48c33bbca40a90.tar.gz
eclipse.platform.team-77091a8df259ac6d96b46ffa8e48c33bbca40a90.tar.xz
eclipse.platform.team-77091a8df259ac6d96b46ffa8e48c33bbca40a90.zip
31895: [CVS Core] RepositoryManager is grab bag, needs refactoringRoot_branch_20040329_DateTag
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java252
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java95
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java143
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java198
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java179
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java22
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java96
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitOperation.java81
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java21
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java27
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java12
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java63
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java14
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java2
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java4
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java3
-rw-r--r--tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java2
21 files changed, 569 insertions, 757 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
index 7b618ad82..f3ff9652f 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java
@@ -152,157 +152,12 @@ public class CVSTeamProvider extends RepositoryProvider {
// Ignore exceptions here. They will be surfaced elsewhere
}
}
-
-
-
- /**
- * Add the given resources to the project.
- * <p>
- * The sematics follow that of CVS in the sense that any folders
- * being added are created remotely as a result of this operation
- * while files are created remotely on the next commit.
- * </p>
- * <p>
- * This method uses the team file type registry to determine the type
- * of added files. If the extension of the file is not in the registry,
- * the file is assumed to be binary.
- * </p>
- * <p>
- * NOTE: for now we do three operations: one each for folders, text files and binary files.
- * We should optimize this when time permits to either use one operations or defer server
- * contact until the next commit.
- * </p>
- *
- * <p>
- * There are special semantics for adding the project itself to the repo. In this case, the project
- * must be included in the resources array.
- * </p>
- */
- public void add(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
-
- // Visit the children of the resources using the depth in order to
- // determine which folders, text files and binary files need to be added
- // A TreeSet is needed for the folders so they are in the right order (i.e. parents created before children)
- final SortedSet folders = new TreeSet();
- // Sets are required for the files to ensure that files will not appear twice if there parent was added as well
- // and the depth isn't zero
- final Map /* from KSubstOption to Set */ files = new HashMap();
- final TeamException[] eHolder = new TeamException[1];
- for (int i=0; i<resources.length; i++) {
-
- final IResource currentResource = resources[i];
-
- // Throw an exception if the resource is not a child of the receiver
- checkIsChild(currentResource);
-
- try {
- // Auto-add parents if they are not already managed
- IContainer parent = currentResource.getParent();
- ICVSResource cvsParentResource = CVSWorkspaceRoot.getCVSResourceFor(parent);
- while (parent.getType() != IResource.ROOT && parent.getType() != IResource.PROJECT && ! isManaged(cvsParentResource)) {
- folders.add(cvsParentResource);
- parent = parent.getParent();
- cvsParentResource = cvsParentResource.getParent();
- }
-
- // Auto-add children
- final TeamException[] exception = new TeamException[] { null };
- currentResource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) {
- try {
- ICVSResource mResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- // Add the resource is its not already managed and it was either
- // added explicitly (is equal currentResource) or is not ignored
- if (! isManaged(mResource) && (currentResource.equals(resource) || ! mResource.isIgnored())) {
- if (resource.getType() == IResource.FILE) {
- KSubstOption ksubst = KSubstOption.fromFile((IFile) resource);
- Set set = (Set) files.get(ksubst);
- if (set == null) {
- set = new HashSet();
- files.put(ksubst, set);
- }
- set.add(mResource);
- } else {
- folders.add(mResource);
- }
- }
- // Always return true and let the depth determine if children are visited
- return true;
- } catch (CVSException e) {
- exception[0] = e;
- return false;
- }
- }
- }, depth, false);
- if (exception[0] != null) {
- throw exception[0];
- }
- } catch (CoreException e) {
- throw new CVSException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, Policy.bind("CVSTeamProvider.visitError", new Object[] {resources[i].getFullPath()}), e)); //$NON-NLS-1$
- }
- }
- // If an exception occured during the visit, throw it here
- if (eHolder[0] != null)
- throw eHolder[0];
-
- // Add the folders, followed by files!
- progress.beginTask(null, files.size() * 10 + (folders.isEmpty() ? 0 : 10));
- try {
- if (!folders.isEmpty()) {
- Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
- session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
- try {
- IStatus status = Command.ADD.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- (ICVSResource[])folders.toArray(new ICVSResource[folders.size()]),
- null,
- Policy.subMonitorFor(progress, 8));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- session.close();
- }
- }
- for (Iterator it = files.entrySet().iterator(); it.hasNext();) {
- Map.Entry entry = (Map.Entry) it.next();
- final KSubstOption ksubst = (KSubstOption) entry.getKey();
- final Set set = (Set) entry.getValue();
- Session session = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot(), true /* output to console */);
- session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
- try {
- IStatus status = Command.ADD.execute(
- session,
- Command.NO_GLOBAL_OPTIONS,
- new LocalOption[] { ksubst },
- (ICVSResource[])set.toArray(new ICVSResource[set.size()]),
- null,
- Policy.subMonitorFor(progress, 8));
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- session.close();
- }
- }
- } finally {
- progress.done();
- }
- }
-
- /*
- * Consider a folder managed only if it's also a CVS folder
- */
- private boolean isManaged(ICVSResource cvsResource) throws CVSException {
- return cvsResource.isManaged() && (!cvsResource.isFolder() || ((ICVSFolder)cvsResource).isCVSFolder());
- }
/**
* Checkin any local changes using "cvs commit ...".
*
- * @see ITeamProvider#checkin(IResource[], int, IProgressMonitor)
+ * TODO: This method can be removed once the RelEng plugin no longer uses it
+ * @deprecated use CommitOperation instead
*/
public void checkin(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
@@ -339,82 +194,6 @@ public class CVSTeamProvider extends RepositoryProvider {
throw new CVSServerException(status);
}
}
-
- /**
- * @see ITeamProvider#delete(IResource[], int, IProgressMonitor)
- */
- public void delete(IResource[] resources, final IProgressMonitor progress) throws TeamException {
- try {
- progress.beginTask(null, 100);
-
- // Delete any files locally and record the names.
- // Use a resource visitor to ensure the proper depth is obtained
- final IProgressMonitor subProgress = Policy.infiniteSubMonitorFor(progress, 30);
- subProgress.beginTask(null, 256);
- final List files = new ArrayList(resources.length);
- final TeamException[] eHolder = new TeamException[1];
- for (int i=0;i<resources.length;i++) {
- IResource resource = resources[i];
- checkIsChild(resource);
- try {
- if (resource.exists()) {
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) {
- try {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (cvsResource.isManaged()) {
- String name = resource.getProjectRelativePath().toString();
- if (resource.getType() == IResource.FILE) {
- files.add(name);
- ((IFile)resource).delete(false, true, subProgress);
- }
- }
- } catch (TeamException e) {
- eHolder[0] = e;
- } catch (CoreException e) {
- eHolder[0] = wrapException(e);
- // If there was a problem, don't visit the children
- return false;
- }
- // Always return true and let the depth determine if children are visited
- return true;
- }
- }, IResource.DEPTH_INFINITE, false);
- } else if (resource.getType() == IResource.FILE) {
- // If the resource doesn't exist but is a file, queue it for removal
- files.add(resource.getProjectRelativePath().toString());
- }
- } catch (CoreException e) {
- throw wrapException(e);
- }
- }
- subProgress.done();
- // If an exception occured during the visit, throw it here
- if (eHolder[0] != null) throw eHolder[0];
- // If there are no files to delete, we are done
- if (files.isEmpty()) return;
-
- // Remove the files remotely
- IStatus status;
- Session s = new Session(workspaceRoot.getRemoteLocation(), workspaceRoot.getLocalRoot());
- s.open(Policy.subMonitorFor(progress, 10), true /* open for modification */);
- try {
- status = Command.REMOVE.execute(s,
- Command.NO_GLOBAL_OPTIONS,
- Command.NO_LOCAL_OPTIONS,
- (String[])files.toArray(new String[files.size()]),
- null,
- Policy.subMonitorFor(progress, 60));
- } finally {
- s.close();
- }
- if (status.getCode() == CVSStatus.SERVER_ERROR) {
- throw new CVSServerException(status);
- }
- } finally {
- progress.done();
- }
- }
/**
* Diff the resources with the repository and write the output to the provided
@@ -675,12 +454,6 @@ public class CVSTeamProvider extends RepositoryProvider {
monitor.done();
}
}
-
- /**
- * @see ITeamProvider#move(IResource, IPath, IProgressMonitor)
- */
- public void moved(IPath source, IResource resource, IProgressMonitor progress) throws TeamException {
- }
/**
* Set the comment to be used on the next checkin
@@ -714,7 +487,7 @@ public class CVSTeamProvider extends RepositoryProvider {
monitor.subTask(Policy.bind("CVSTeamProvider.updatingFile", file.getName())); //$NON-NLS-1$
file.setSyncBytes(ResourceSyncInfo.setTag(syncBytes, tag), ICVSFile.UNKNOWN);
}
- };
+ }
public void visitFolder(ICVSFolder folder) throws CVSException {
monitor.worked(1);
FolderSyncInfo info = folder.getFolderSyncInfo();
@@ -723,7 +496,7 @@ public class CVSTeamProvider extends RepositoryProvider {
folder.setFolderSyncInfo(new FolderSyncInfo(info.getRepository(), info.getRoot(), tag, info.getIsStatic()));
folder.acceptChildren(this);
}
- };
+ }
});
}
} finally {
@@ -741,7 +514,9 @@ public class CVSTeamProvider extends RepositoryProvider {
* will be appropriatly tagged. If the tag is HEAD, then there will be no tag on the resources (same as -A
* clear sticky option).
*
+ * TODO: This method can be removed once the RelEng plugin no longer uses it
* @param createBackups if true, creates .# files for updated files
+ * @deprecated use UpdateOperation instead
*/
public void update(IResource[] resources, LocalOption[] options, CVSTag tag, boolean createBackups, IProgressMonitor progress) throws TeamException {
progress.beginTask(null, 100);
@@ -781,13 +556,6 @@ public class CVSTeamProvider extends RepositoryProvider {
}
/*
- * @see ITeamProvider#refreshState(IResource[], int, IProgressMonitor)
- */
- public void refreshState(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
- Assert.isTrue(false);
- }
-
- /*
* @see ITeamProvider#isDirty(IResource)
*/
public boolean isDirty(IResource resource) {
@@ -856,7 +624,7 @@ public class CVSTeamProvider extends RepositoryProvider {
// Visit all the children folders in order to set the root in the folder sync info
workspaceRoot.getLocalRoot().accept(new ICVSResourceVisitor() {
- public void visitFile(ICVSFile file) throws CVSException {};
+ public void visitFile(ICVSFile file) throws CVSException {}
public void visitFolder(ICVSFolder folder) throws CVSException {
monitor.worked(1);
FolderSyncInfo info = folder.getFolderSyncInfo();
@@ -865,7 +633,7 @@ public class CVSTeamProvider extends RepositoryProvider {
folder.setFolderSyncInfo(new FolderSyncInfo(info.getRepository(), root, info.getTag(), info.getIsStatic()));
folder.acceptChildren(this);
}
- };
+ }
});
} finally {
progress.done();
@@ -884,10 +652,6 @@ public class CVSTeamProvider extends RepositoryProvider {
return resource.getProject().getName().equals(project.getName());
}
- private static TeamException wrapException(CoreException e) {
- return CVSException.wrapException(e);
- }
-
public void configureProject() throws CoreException {
ResourceStateChangeListeners.getListener().projectConfigured(getProject());
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
index 925a69048..928a0b7ea 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
@@ -25,13 +25,13 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.*;
-import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
+import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.help.WorkbenchHelp;
@@ -108,7 +108,6 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
return entry;
}
public String getName() {
- ICVSRemoteResource edition = getRemoteResource();
String revisionName = entry.getRevision();
if (revisionName != null) {
IResource resource = CVSCompareRevisionsInput.this.resource;
@@ -125,7 +124,7 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
}
return super.getName();
}
- };
+ }
/**
* A compare node that gets its label from the right element
@@ -146,7 +145,7 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
public void fireContentChanges() {
fireChange();
}
- };
+ }
/**
* A content provider which knows how to get the children of the diff container
*/
@@ -161,7 +160,7 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
}
return null;
}
- };
+ }
public CVSCompareRevisionsInput(IFile resource, ILogEntry[] editions) {
super(new CompareConfiguration());
@@ -207,7 +206,7 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
}
private void initLabels() {
- CompareConfiguration cc = (CompareConfiguration)getCompareConfiguration();
+ CompareConfiguration cc = getCompareConfiguration();
cc.setLeftEditable(true);
cc.setRightEditable(false);
String resourceName = resource.getName();
@@ -230,11 +229,14 @@ public class CVSCompareRevisionsInput extends CompareEditorInput {
// Do the load. This just consists of setting the local contents. We don't
// actually want to change the base.
try {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resource.getProject());
CVSTag revisionTag = new CVSTag(((ICVSRemoteFile)edition).getRevision(), CVSTag.VERSION);
- if(CVSAction.checkForMixingTags(shell, new IResource[] {resource}, revisionTag)) {
- provider.update(new IResource[] {resource}, new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
- revisionTag, true /*create backups*/, monitor);
+ if(CVSAction.checkForMixingTags(shell, new IResource[] {resource}, revisionTag)) {
+ new UpdateOperation(
+ null,
+ new IResource[] {resource},
+ new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
+ revisionTag)
+ .run(monitor);
getHistoryTableProvider().setFile((ICVSFile)edition);
}
} catch (TeamException e) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
index 38c0246ad..98ea18d4b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/HistoryView.java
@@ -16,87 +16,33 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Iterator;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.text.*;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.*;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
-import org.eclipse.team.internal.ccvs.core.CVSSyncInfo;
-import org.eclipse.team.internal.ccvs.core.CVSTag;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.core.ICVSFile;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ILogEntry;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Update;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
-import org.eclipse.team.internal.ccvs.ui.actions.MoveRemoteTagAction;
-import org.eclipse.team.internal.ccvs.ui.actions.OpenLogEntryAction;
+import org.eclipse.team.internal.ccvs.ui.actions.*;
+import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.SyncInfoCompareInput;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.*;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.part.ResourceTransfer;
@@ -273,18 +219,23 @@ public class HistoryView extends ViewPart {
ICVSRemoteFile remoteFile = currentSelection.getRemoteFile();
try {
if(confirmOverwrite()) {
- CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(file.getProject());
CVSTag revisionTag = new CVSTag(remoteFile.getRevision(), CVSTag.VERSION);
- if(CVSAction.checkForMixingTags(getSite().getShell(), new IResource[] {file}, revisionTag)) {
- provider.update(new IResource[] {file}, new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
- revisionTag, true /*create backups*/, monitor);
+ if(CVSAction.checkForMixingTags(getSite().getShell(), new IResource[] {file}, revisionTag)) {
+ new UpdateOperation(
+ null,
+ new IResource[] {file},
+ new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES},
+ revisionTag)
+ .run(monitor);
historyTableProvider.setFile(remoteFile);
tableViewer.refresh();
}
}
- } catch (TeamException e) {
- throw new CoreException(e.getStatus());
+ } catch (InvocationTargetException e) {
+ 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/AddAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
index 4ba874e43..394c17844 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
@@ -11,22 +11,15 @@
package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.team.internal.ccvs.ui.operations.AddOperation;
/**
* AddAction performs a 'cvs add' command on the selected resources. If a
@@ -34,34 +27,12 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
*/
public class AddAction extends WorkspaceAction {
- /*
- * @see CVSAction#execute()
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#execute(org.eclipse.jface.action.IAction)
*/
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
if (!promptForAddOfIgnored()) return;
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Hashtable table = getProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("AddAction.adding")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = Policy.subMonitorFor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.add(providerResources, IResource.DEPTH_INFINITE, subMonitor);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, true /* cancelable */, PROGRESS_DIALOG);
-
+ new AddOperation(getTargetPart(), getSelectedResources()).run();
}
/**
@@ -87,13 +58,6 @@ public class AddAction extends WorkspaceAction {
return true;
}
- /*
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("AddAction.addFailed"); //$NON-NLS-1$
- }
-
/**
* @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForManagedResources()
*/
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
index 1e7d83102..f9cfeacd5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
@@ -11,26 +11,13 @@
package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSResource;
-import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
-import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-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.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.team.internal.ccvs.ui.operations.CommitOperation;
/**
* Action for checking in files to a CVS provider.
@@ -42,134 +29,20 @@ public class CommitAction extends WorkspaceAction {
* @see CVSAction#execute(IAction)
*/
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final IResource[] resources = getSelectedResources();
- final RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- final String[] comment = new String[] {null};
- final IResource[][] resourcesToBeAdded = new IResource[][] { null };
+ final CommitOperation operation = new CommitOperation(getTargetPart(), getSelectedResources(), null);
run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
- // search for any non-added, non-ignored resources in the selection
- IResource[] unadded = getUnaddedResources(resources, monitor);
- resourcesToBeAdded[0] = promptForResourcesToBeAdded(manager, unadded);
- if (resourcesToBeAdded[0] == null) return;
- comment[0] = promptForComment(manager, resources);
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, true /* cancelable */, PROGRESS_BUSYCURSOR); //$NON-NLS-1$
-
- if (comment[0] == null) return;
-
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- // execute the add and commit in a single CVS runnable so sync changes are batched
- CVSWorkspaceRoot.getCVSFolderFor(ResourcesPlugin.getWorkspace().getRoot()).run(
- new ICVSRunnable() {
- public void run(IProgressMonitor monitor) throws CVSException {
- try {
- int ticks=100;
- monitor.beginTask(null, ticks);
- if (resourcesToBeAdded[0].length > 0) {
- int addTicks = 20;
- manager.add(resourcesToBeAdded[0], Policy.subMonitorFor(monitor, addTicks));
- ticks-=addTicks;
- }
- IResource[] shared = getSharedResources(resources);
- if (shared.length == 0) return;
- manager.commit(shared, comment[0], Policy.subMonitorFor(monitor,ticks));
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
- }
- }
- }, monitor);
+ operation.performPrompting(monitor);
} catch (CVSException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
+ new InvocationTargetException(e);
+ }
}
- }, true /* cancelable */, PROGRESS_DIALOG); //$NON-NLS-1$
+ }, false, PROGRESS_BUSYCURSOR);
+ operation.run();
}
/**
- * Method getUnaddedResources.
- * @param resources
- * @param iProgressMonitor
- * @return IResource[]
- */
- private IResource[] getUnaddedResources(IResource[] resources, IProgressMonitor iProgressMonitor) throws CVSException {
- final List unadded = new ArrayList();
- final CVSException[] exception = new CVSException[] { null };
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- // visit each resource deeply
- try {
- resource.accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- // skip ignored resources and their children
- try {
- if (cvsResource.isIgnored())
- return false;
- // visit the children of shared resources
- if (cvsResource.isManaged())
- return true;
- if (cvsResource.isFolder() && ((ICVSFolder)cvsResource).isCVSFolder())
- return true;
- } catch (CVSException e) {
- exception[0] = e;
- }
- // don't add folders to avoid comitting empty folders
- if (resource.getType() == IResource.FOLDER)
- return true;
- // file is unshared so record it
- unadded.add(resource);
- // no need to go into children because add is deep
- return false;
- }
- });
- } catch (CoreException e) {
- throw CVSException.wrapException(e);
- }
- if (exception[0] != null) throw exception[0];
- }
- return (IResource[]) unadded.toArray(new IResource[unadded.size()]);
- }
-
-
- /*
- * Return all resources in the provided collection that are shared with a repo
- * @param resources
- * @return IResource[]
- */
- private IResource[] getSharedResources(IResource[] resources) throws CVSException {
- List shared = new ArrayList();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (cvsResource.isManaged()
- || (cvsResource.isFolder() && ((ICVSFolder)cvsResource).isCVSFolder())) {
- shared.add(resource);
- }
- }
- return (IResource[]) shared.toArray(new IResource[shared.size()]);
- }
-
- /**
- * Prompts the user for a release comment.
- * @return the comment, or null to cancel
- */
- protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
- return manager.promptForComment(getShell(), resourcesToCommit);
- }
-
- private IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
- return manager.promptForResourcesToBeAdded(getShell(), unadded);
- }
- /**
* @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
*/
protected String getErrorTitle() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
index 8b875af3f..e144fa250 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
@@ -11,20 +11,10 @@
package org.eclipse.team.internal.ccvs.ui.actions;
import java.lang.reflect.InvocationTargetException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
/**
* UpdateAction performs a 'cvs update' command on the selected resources.
@@ -38,36 +28,8 @@ public class UpdateAction extends WorkspaceAction {
* @see IActionDelegate#run(IAction)
*/
public void execute(IAction action) throws InterruptedException, InvocationTargetException {
- run(new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- Hashtable table = getProviderMapping();
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("UpdateAction.updating")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.update(providerResources, Command.NO_LOCAL_OPTIONS, null, true /*createBackups*/, subMonitor);
- }
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
- }, true /* cancelable */, PROGRESS_DIALOG);
-
- }
-
- /**
- * @see org.eclipse.team.internal.ccvs.ui.actions.CVSAction#getErrorTitle()
- */
- protected String getErrorTitle() {
- return Policy.bind("UpdateAction.update"); //$NON-NLS-1$
+ new UpdateOperation(getTargetPart(), getSelectedResources(), Command.NO_LOCAL_OPTIONS, null /* use the tag of the resources */)
+ .run();
}
/**
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
new file mode 100644
index 000000000..27659080d
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/AddOperation.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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.operations;
+
+import java.util.*;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.core.client.Session;
+import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
+import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Performs a "cvs add"
+ */
+public class AddOperation extends RepositoryProviderOperation {
+
+ public AddOperation(IWorkbenchPart part, IResource[] resources) {
+ super(part, resources);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected void execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
+ add(provider, resources, IResource.DEPTH_INFINITE, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
+ */
+ protected String getTaskName() {
+ return Policy.bind("AddAction.adding"); //$NON-NLS-1$
+ }
+
+ /*
+ * Add the given resources to the project.
+ * <p>
+ * The sematics follow that of CVS in the sense that any folders
+ * being added are created remotely as a result of this operation
+ * while files are created remotely on the next commit.
+ * </p>
+ * <p>
+ * This method uses the team file type registry to determine the type
+ * of added files. If the extension of the file is not in the registry,
+ * the file is assumed to be binary.
+ * </p>
+ * <p>
+ * NOTE: for now we do three operations: one each for folders, text files and binary files.
+ * We should optimize this when time permits to either use one operations or defer server
+ * contact until the next commit.
+ * </p>
+ *
+ * <p>
+ * There are special semantics for adding the project itself to the repo. In this case, the project
+ * must be included in the resources array.
+ * </p>
+ */
+ private void add(CVSTeamProvider provider, IResource[] resources, int depth, IProgressMonitor progress) throws CVSException {
+
+ // Visit the children of the resources using the depth in order to
+ // determine which folders, text files and binary files need to be added
+ // A TreeSet is needed for the folders so they are in the right order (i.e. parents created before children)
+ final SortedSet folders = new TreeSet();
+ // Sets are required for the files to ensure that files will not appear twice if there parent was added as well
+ // and the depth isn't zero
+ final Map /* from KSubstOption to Set */ files = new HashMap();
+ final CVSException[] eHolder = new CVSException[1];
+ for (int i=0; i<resources.length; i++) {
+
+ final IResource currentResource = resources[i];
+
+ try {
+ // Auto-add parents if they are not already managed
+ IContainer parent = currentResource.getParent();
+ ICVSResource cvsParentResource = CVSWorkspaceRoot.getCVSResourceFor(parent);
+ while (parent.getType() != IResource.ROOT && parent.getType() != IResource.PROJECT && ! isManaged(cvsParentResource)) {
+ folders.add(cvsParentResource);
+ parent = parent.getParent();
+ cvsParentResource = cvsParentResource.getParent();
+ }
+
+ // Auto-add children
+ final TeamException[] exception = new TeamException[] { null };
+ currentResource.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource) {
+ try {
+ ICVSResource mResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ // Add the resource is its not already managed and it was either
+ // added explicitly (is equal currentResource) or is not ignored
+ if (! isManaged(mResource) && (currentResource.equals(resource) || ! mResource.isIgnored())) {
+ if (resource.getType() == IResource.FILE) {
+ KSubstOption ksubst = KSubstOption.fromFile((IFile) resource);
+ Set set = (Set) files.get(ksubst);
+ if (set == null) {
+ set = new HashSet();
+ files.put(ksubst, set);
+ }
+ set.add(mResource);
+ } else {
+ folders.add(mResource);
+ }
+ }
+ // Always return true and let the depth determine if children are visited
+ return true;
+ } catch (CVSException e) {
+ exception[0] = e;
+ return false;
+ }
+ }
+ }, depth, false);
+ if (exception[0] != null) {
+ throw exception[0];
+ }
+ } catch (CoreException e) {
+ throw new CVSException(new Status(IStatus.ERROR, CVSProviderPlugin.ID, TeamException.UNABLE, Policy.bind("CVSTeamProvider.visitError", new Object[] {resources[i].getFullPath()}), e)); //$NON-NLS-1$
+ }
+ }
+ // If an exception occured during the visit, throw it here
+ if (eHolder[0] != null)
+ throw eHolder[0];
+
+ // Add the folders, followed by files!
+ progress.beginTask(null, files.size() * 10 + (folders.isEmpty() ? 0 : 10));
+ try {
+ if (!folders.isEmpty()) {
+ Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
+ session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
+ try {
+ IStatus status = Command.ADD.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ Command.NO_LOCAL_OPTIONS,
+ (ICVSResource[])folders.toArray(new ICVSResource[folders.size()]),
+ null,
+ Policy.subMonitorFor(progress, 8));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
+ }
+ } finally {
+ session.close();
+ }
+ }
+ for (Iterator it = files.entrySet().iterator(); it.hasNext();) {
+ Map.Entry entry = (Map.Entry) it.next();
+ final KSubstOption ksubst = (KSubstOption) entry.getKey();
+ final Set set = (Set) entry.getValue();
+ Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
+ session.open(Policy.subMonitorFor(progress, 2), true /* open for modification */);
+ try {
+ IStatus status = Command.ADD.execute(
+ session,
+ Command.NO_GLOBAL_OPTIONS,
+ new LocalOption[] { ksubst },
+ (ICVSResource[])set.toArray(new ICVSResource[set.size()]),
+ null,
+ Policy.subMonitorFor(progress, 8));
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ throw new CVSServerException(status);
+ }
+ } finally {
+ session.close();
+ }
+ }
+ } finally {
+ progress.done();
+ }
+ }
+
+ /*
+ * Consider a folder managed only if it's also a CVS folder
+ */
+ private boolean isManaged(ICVSResource cvsResource) throws CVSException {
+ return cvsResource.isManaged() && (!cvsResource.isFolder() || ((ICVSFolder)cvsResource).isCVSFolder());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
+ */
+ protected String getErrorMessage(IStatus[] failures, int totalOperations) {
+ return Policy.bind("AddAction.addFailed"); //$NON-NLS-1$
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
new file mode 100644
index 000000000..052cac26e
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitOperation.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 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.operations;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.client.*;
+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
+import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Perform a "cvs commit"
+ */
+public class CommitOperation extends SingleCommandOperation {
+
+ public CommitOperation(IWorkbenchPart part, IResource[] resources, LocalOption[] options) {
+ super(part, resources, options);
+ }
+
+ /**
+ * Perform prompting for unadded resources and comment
+ * @param monitor a progess monitor
+ * @return <code>true</code> if execution should continue
+ */
+ public boolean performPrompting(IProgressMonitor monitor) throws CVSException, InvocationTargetException, InterruptedException {
+ monitor.beginTask(null, 20);
+ IResource[] resourcesToBeAdded = promptForResourcesToBeAdded(Policy.subMonitorFor(monitor, 10));
+ String comment = promptForComment(getResources());
+ if (comment == null) return false;
+ addLocalOption(Commit.makeArgumentOption(Command.MESSAGE_OPTION, comment));
+ if (resourcesToBeAdded.length > 0) {
+ new AddOperation(getPart(), resourcesToBeAdded)
+ .run(Policy.subMonitorFor(monitor, 10));
+ }
+ setResources(getSharedResources(getResources()));
+ monitor.done();
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
+ // Ensure that a comment has been provided
+ if (!Command.MESSAGE_OPTION.isElementOf(getLocalOptions())) {
+ String comment = promptForComment(getResources());
+ if (comment == null) return;
+ addLocalOption(Commit.makeArgumentOption(Command.MESSAGE_OPTION, comment));
+ }
+ super.execute(monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, IProgressMonitor monitor) throws CVSException, InterruptedException {
+ return Command.COMMIT.execute(session,
+ Command.NO_GLOBAL_OPTIONS,
+ getLocalOptions(),
+ resources,
+ null,
+ monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#handleErrors(org.eclipse.core.runtime.IStatus[])
+ */
+ protected void handleErrors(IStatus[] errors) throws CVSException {
+ // We are only concerned with server errors
+ List serverErrors = new ArrayList();
+ for (int i = 0; i < errors.length; i++) {
+ IStatus status = errors[i];
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ serverErrors.add(status);
+ }
+ }
+ if (serverErrors.isEmpty()) return;
+ super.handleErrors((IStatus[]) serverErrors.toArray(new IStatus[serverErrors.size()]));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
+ */
+ protected String getTaskName() {
+ return Policy.bind("RepositoryManager.committing"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
+ */
+ protected String getErrorMessage(IStatus[] failures, int totalOperations) {
+ return Policy.bind("CommitAction.commitFailed"); //$NON-NLS-1$
+ }
+
+ private IResource[] getUnaddedResources(IResource[] resources, IProgressMonitor iProgressMonitor) throws CVSException {
+ final List unadded = new ArrayList();
+ final CVSException[] exception = new CVSException[] { null };
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ // visit each resource deeply
+ try {
+ resource.accept(new IResourceVisitor() {
+ public boolean visit(IResource resource) throws CoreException {
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ // skip ignored resources and their children
+ try {
+ if (cvsResource.isIgnored())
+ return false;
+ // visit the children of shared resources
+ if (cvsResource.isManaged())
+ return true;
+ if (cvsResource.isFolder() && ((ICVSFolder)cvsResource).isCVSFolder())
+ return true;
+ } catch (CVSException e) {
+ exception[0] = e;
+ }
+ // don't add folders to avoid comitting empty folders
+ if (resource.getType() == IResource.FOLDER)
+ return true;
+ // file is unshared so record it
+ unadded.add(resource);
+ // no need to go into children because add is deep
+ return false;
+ }
+ });
+ } catch (CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ if (exception[0] != null) throw exception[0];
+ }
+ return (IResource[]) unadded.toArray(new IResource[unadded.size()]);
+ }
+
+ protected IResource[] promptForResourcesToBeAdded(IProgressMonitor monitor) throws CVSException {
+ IResource[] unadded = getUnaddedResources(getResources(), monitor);
+ RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
+ return manager.promptForResourcesToBeAdded(getShell(), unadded);
+ }
+
+ protected String promptForComment(IResource[] resourcesToCommit) {
+ RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
+ return manager.promptForComment(getShell(), resourcesToCommit);
+ }
+
+ /*
+ * Return all resources in the provided collection that are shared with a repo
+ * @param resources
+ * @return IResource[]
+ */
+ private IResource[] getSharedResources(IResource[] resources) throws CVSException {
+ List shared = new ArrayList();
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if (cvsResource.isManaged()
+ || (cvsResource.isFolder() && ((ICVSFolder)cvsResource).isCVSFolder())) {
+ shared.add(resource);
+ }
+ }
+ return (IResource[]) shared.toArray(new IResource[shared.size()]);
+ }
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
index 38bd65700..bf09a103b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
@@ -95,5 +95,27 @@ public class UpdateOperation extends SingleCommandOperation {
protected ICommandOutputListener getCommandOutputListener() {
return null;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#handleErrors(org.eclipse.core.runtime.IStatus[])
+ */
+ protected void handleErrors(IStatus[] errors) throws CVSException {
+ // We are only concerned with server errors
+ List serverErrors = new ArrayList();
+ for (int i = 0; i < errors.length; i++) {
+ IStatus status = errors[i];
+ if (status.getCode() == CVSStatus.SERVER_ERROR) {
+ serverErrors.add(status);
+ }
+ }
+ if (serverErrors.isEmpty()) return;
+ super.handleErrors((IStatus[]) serverErrors.toArray(new IStatus[serverErrors.size()]));
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
+ */
+ protected String getErrorMessage(IStatus[] failures, int totalOperations) {
+ return Policy.bind("UpdateAction.update"); //$NON-NLS-1$
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
index 7815b6ad8..5f34ccd66 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
@@ -23,10 +23,8 @@ import org.eclipse.core.runtime.*;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
import org.eclipse.team.internal.ccvs.ui.*;
@@ -515,26 +513,6 @@ public class RepositoryManager {
}
/**
- * Add the given resources to their associated providers.
- * This schedules the resources for addition; they still need to be committed.
- */
- public void add(IResource[] resources, IProgressMonitor monitor) throws TeamException {
- Map table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("RepositoryManager.adding")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- provider.setComment(getCurrentComment());
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.add(providerResources, IResource.DEPTH_ZERO, subMonitor);
- }
- }
-
- /**
* Method getCurrentComment.
* @return String
*/
@@ -543,41 +521,6 @@ public class RepositoryManager {
return ""; //$NON-NLS-1$
return previousComments[0];
}
-
- /**
- * Delete the given resources from their associated providers.
- * This schedules the resources for deletion; they still need to be committed.
- */
- public void delete(IResource[] resources, IProgressMonitor monitor) throws TeamException {
- Map table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("RepositoryManager.deleting")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- provider.setComment(getCurrentComment());
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.delete(providerResources, subMonitor);
- }
- }
-
- public void update(IResource[] resources, Command.LocalOption[] options, boolean createBackups, IProgressMonitor monitor) throws TeamException {
- Map table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("RepositoryManager.updating")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.update(providerResources, options, null, createBackups, subMonitor);
- }
- }
/**
* Return the entered comment or null if canceled.
@@ -622,45 +565,6 @@ public class RepositoryManager {
});
return result[0];
}
- /**
- * Commit the given resources to their associated providers.
- *
- * @param resources the resources to commit
- * @param monitor the progress monitor
- */
- public void commit(IResource[] resources, String comment, IProgressMonitor monitor) throws TeamException {
- Map table = getProviderMapping(resources);
- Set keySet = table.keySet();
- monitor.beginTask("", keySet.size() * 1000); //$NON-NLS-1$
- monitor.setTaskName(Policy.bind("RepositoryManager.committing")); //$NON-NLS-1$
- Iterator iterator = keySet.iterator();
- while (iterator.hasNext()) {
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1000);
- CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
- provider.setComment(comment);
- List list = (List)table.get(provider);
- IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
- provider.checkin(providerResources, IResource.DEPTH_INFINITE, subMonitor);
- }
- }
-
- /**
- * Helper method. Return a Map mapping provider to a list of resources
- * shared with that provider.
- */
- private Map getProviderMapping(IResource[] resources) {
- Map result = new HashMap();
- for (int i = 0; i < resources.length; i++) {
- RepositoryProvider provider = RepositoryProvider.getProvider(resources[i].getProject(), CVSProviderPlugin.getTypeId());
- List list = (List)result.get(provider);
- if (list == null) {
- list = new ArrayList();
- result.put(provider, list);
- }
- list.add(resources[i]);
- }
- return result;
- }
public ICVSRepositoryLocation getRepositoryLocationFor(ICVSResource resource) {
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitOperation.java
index a8b239722..8718a7c45 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/SubscriberCommitOperation.java
@@ -10,12 +10,14 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.subscriber;
+import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
@@ -23,10 +25,13 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.client.Command;
+import org.eclipse.team.internal.ccvs.core.client.Commit;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.operations.AddOperation;
+import org.eclipse.team.internal.ccvs.ui.operations.CommitOperation;
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;
@@ -119,8 +124,6 @@ public class SubscriberCommitOperation extends CVSSubscriberOperation {
final List commits = new ArrayList(); // of IResource
// New resources that are not yet under CVS control and need a "cvs add"
final List additions = new ArrayList(); // of IResource
- // Deleted resources that need a "cvs remove"
- final List deletions = new ArrayList(); // of IResource
// A list of incoming or conflicting file changes to be made outgoing changes
final List makeOutgoing = new ArrayList(); // of SyncInfo
// A list of out-of-sync folders that must be made in-sync
@@ -157,9 +160,8 @@ public class SubscriberCommitOperation extends CVSSubscriberOperation {
additions.add(resource);
break;
case SyncInfo.DELETION:
- // Outgoing deletion. 'delete' it before committing.
- if (!isRemoved(resource))
- deletions.add(resource);
+ // Outgoing deletion is handled by move/delete
+ // hook and EclipseSynchronizer
break;
case SyncInfo.CHANGE:
// Outgoing change. Just commit it.
@@ -182,33 +184,46 @@ public class SubscriberCommitOperation extends CVSSubscriberOperation {
}
}
}
- try {
- // Calculate the total amount of work needed
- int work = (makeOutgoing.size() + additions.size() + deletions.size() + commits.size()) * 100;
- monitor.beginTask(null, work);
-
- if (makeInSync.size() > 0) {
- makeInSync((SyncInfo[]) makeInSync.toArray(new SyncInfo[makeInSync.size()]));
- }
+ // Calculate the total amount of work needed
+ int work = (makeOutgoing.size() + additions.size() + commits.size()) * 100;
+ monitor.beginTask(null, work);
+
+ if (makeInSync.size() > 0) {
+ makeInSync((SyncInfo[]) makeInSync.toArray(new SyncInfo[makeInSync.size()]));
+ }
- if (makeOutgoing.size() > 0) {
- makeOutgoing((SyncInfo[]) makeOutgoing.toArray(new SyncInfo[makeInSync.size()]), Policy.subMonitorFor(monitor, makeOutgoing.size() * 100));
- }
+ if (makeOutgoing.size() > 0) {
+ makeOutgoing((SyncInfo[]) makeOutgoing.toArray(new SyncInfo[makeInSync.size()]), Policy.subMonitorFor(monitor, makeOutgoing.size() * 100));
+ }
- RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
- if (additions.size() != 0) {
- manager.add((IResource[])additions.toArray(new IResource[0]), Policy.subMonitorFor(monitor, additions.size() * 100));
- }
- if (deletions.size() != 0) {
- manager.delete((IResource[])deletions.toArray(new IResource[0]), Policy.subMonitorFor(monitor, deletions.size() * 100));
- }
- manager.commit((IResource[])commits.toArray(new IResource[commits.size()]), comment, Policy.subMonitorFor(monitor, commits.size() * 100));
-
- } catch (TeamException e) {
- throw CVSException.wrapException(e);
+ if (additions.size() != 0) {
+ add((IResource[])additions.toArray(new IResource[0]), Policy.subMonitorFor(monitor, additions.size() * 100));
}
+ commit((IResource[])commits.toArray(new IResource[commits.size()]), Policy.subMonitorFor(monitor, commits.size() * 100));
}
+ private void commit(IResource[] commits, IProgressMonitor monitor) throws TeamException {
+ try {
+ new CommitOperation(getPart(), commits,
+ new Command.LocalOption[] { Commit.makeArgumentOption(Command.MESSAGE_OPTION, comment) })
+ .run(monitor);
+ } catch (InvocationTargetException e) {
+ throw TeamException.asTeamException(e);
+ } catch (InterruptedException e) {
+ throw new OperationCanceledException();
+ }
+ }
+
+ private void add(IResource[] additions, IProgressMonitor monitor) throws TeamException {
+ try {
+ new AddOperation(getPart(), additions).run(monitor);
+ } catch (InvocationTargetException e1) {
+ throw TeamException.asTeamException(e1);
+ } catch (InterruptedException e1) {
+ throw new OperationCanceledException();
+ }
+ }
+
/**
* Prompts the user to determine how conflicting changes should be handled.
* Note: This method is designed to be overridden by test cases.
@@ -303,14 +318,4 @@ public class SubscriberCommitOperation extends CVSSubscriberOperation {
}
}
- private boolean isRemoved(IResource resource) throws CVSException {
- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (!cvsResource.isFolder()) {
- byte[] syncBytes = ((ICVSFile)cvsResource).getSyncBytes();
- if (syncBytes == null) return true;
- return ResourceSyncInfo.isDeletion(syncBytes);
- }
- return true;
- }
-
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
index 8125cccb3..f7b4501fa 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/UpdateWizard.java
@@ -20,12 +20,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
-import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.*;
+import org.eclipse.team.internal.ccvs.ui.operations.UpdateOperation;
public class UpdateWizard extends Wizard {
@@ -65,12 +61,15 @@ public class UpdateWizard extends Wizard {
getContainer().run(false, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
- CVSTeamProvider provider = ((CVSTeamProvider)RepositoryProvider.getProvider(project));
- provider.update(new IResource[] { project }, updatePage.getLocalOptions(),
- updatePage.getTag(), true /*createBackups*/, monitor);
+ new UpdateOperation(
+ null, /* workbench part */ // TODO: Shoild have a part
+ new IResource[] { project },
+ updatePage.getLocalOptions(),
+ updatePage.getTag())
+ .run(monitor);
result[0] = true;
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
+ } catch (InterruptedException e) {
+ // User cancelled
} finally {
monitor.done();
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
index a5a638414..07e7b8c2b 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/EclipseTest.java
@@ -90,10 +90,11 @@ public class EclipseTest extends EclipseWorkspaceTest {
return newResources;
}
- protected void addResources(IResource[] newResources) throws TeamException, CoreException {
+ protected void addResources(IResource[] newResources) throws CoreException {
if (newResources.length == 0) return;
- getProvider(newResources[0]).add(newResources, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ executeHeadless(new AddOperation(null, newResources));
}
+
/**
* Perform a CVS edit of the given resources
*/
@@ -176,9 +177,17 @@ public class EclipseTest extends EclipseWorkspaceTest {
return resources;
}
+ /**
+ * Delete the resources and mark them as outgoing deletions.
+ * Deleting the resources is enough since the move/delete hook will
+ * tak care of making them outgoing deletions.
+ */
protected void deleteResources(IResource[] resources) throws TeamException, CoreException {
if (resources.length == 0) return;
- getProvider(resources[0]).delete(resources, DEFAULT_MONITOR);
+ for (int i = 0; i < resources.length; i++) {
+ IResource resource = resources[i];
+ resource.delete(false, DEFAULT_MONITOR);
+ }
}
/**
* Unmanage the resources
@@ -201,8 +210,8 @@ public class EclipseTest extends EclipseWorkspaceTest {
LocalOption[] options = Command.NO_LOCAL_OPTIONS;
if(ignoreLocalChanges) {
options = new LocalOption[] {Update.IGNORE_LOCAL_CHANGES};
- }
- getProvider(container).update(resources, options, null, true /*createBackups*/, DEFAULT_MONITOR);
+ }
+ executeHeadless(new UpdateOperation(null, resources, options, null));
return resources;
}
@@ -222,7 +231,7 @@ public class EclipseTest extends EclipseWorkspaceTest {
if(ignoreLocalChanges) {
options = new LocalOption[] {Update.IGNORE_LOCAL_CHANGES};
}
- getProvider(project).update(new IResource[] {project}, options, tag, true /*createBackups*/, DEFAULT_MONITOR);
+ executeHeadless(new UpdateOperation(null, new IResource[] {project}, options, tag));
}
public void commitProject(IProject project) throws TeamException, CoreException {
@@ -247,7 +256,7 @@ public class EclipseTest extends EclipseWorkspaceTest {
*/
protected void commitResources(IResource[] resources, int depth) throws TeamException, CoreException {
if (resources.length == 0) return;
- getProvider(resources[0]).checkin(resources, depth, DEFAULT_MONITOR);
+ executeHeadless(new CommitOperation(null, resources, new Command.LocalOption[] { Commit.makeArgumentOption(Command.MESSAGE_OPTION, "") }));
}
/**
* Commit the resources from an existing container to the CVS repository
@@ -705,8 +714,8 @@ public class EclipseTest extends EclipseWorkspaceTest {
resourcesToAdd.add(members[i]);
}
}
- getProvider(project).add((IResource[]) resourcesToAdd.toArray(new IResource[resourcesToAdd.size()]), IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
- getProvider(project).checkin(new IResource[] {project}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ addResources((IResource[]) resourcesToAdd.toArray(new IResource[resourcesToAdd.size()]));
+ commitResources(new IResource[] {project}, IResource.DEPTH_INFINITE);
// Pause to ensure that future operations happen later than timestamp of committed resources
waitMsec(1500);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
index 31c55b716..9b02b246b 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/CVSProviderTest.java
@@ -101,11 +101,11 @@ public class CVSProviderTest extends EclipseTest {
// Perform some operations on the project
IResource[] newResources = buildResources(project, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, false);
setContentsAndEnsureModified(project.getFile("changed.txt"));
- getProvider(project).add(newResources, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
- getProvider(project).delete(new IResource[] {project.getFile("deleted.txt")}, DEFAULT_MONITOR);
+ addResources(newResources);
+ deleteResources(new IResource[] {project.getFile("deleted.txt")});
assertIsModified("testDeepCheckin: ", newResources);
assertIsModified("testDeepCheckin: ", new IResource[] {project.getFile("deleted.txt"), project.getFile("changed.txt")});
- getProvider(project).checkin(new IResource[] {project}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ commitResources(new IResource[] {project}, IResource.DEPTH_INFINITE);
assertLocalStateEqualsRemote(project);
}
@@ -138,11 +138,11 @@ public class CVSProviderTest extends EclipseTest {
// Perform some operations on the copy
addResources(copy, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, false);
setContentsAndEnsureModified(copy.getFile("changed.txt"));
- getProvider(copy).delete(new IResource[] {copy.getFile("deleted.txt")}, DEFAULT_MONITOR);
+ deleteResources(new IResource[] {copy.getFile("deleted.txt")});
// Commit the copy and update the project
- getProvider(copy).checkin(new IResource[] {copy}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
- getProvider(project).update(new IResource[] {project}, Command.NO_LOCAL_OPTIONS, null, true /*createBackups*/, DEFAULT_MONITOR);
+ commitResources(new IResource[] {copy}, IResource.DEPTH_INFINITE);
+ updateProject(project, null, false);
assertEquals(project, copy);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
index fc73b503a..cc5c7c8e3 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/IsModifiedTests.java
@@ -12,32 +12,15 @@ package org.eclipse.team.tests.ccvs.core.provider;
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
import org.eclipse.team.core.TeamException;
-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.ICVSResourceVisitor;
-import org.eclipse.team.internal.ccvs.core.IResourceStateChangeListener;
-import org.eclipse.team.internal.ccvs.core.client.Command;
-import org.eclipse.team.internal.ccvs.core.client.Update;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
@@ -280,7 +263,7 @@ public class IsModifiedTests extends EclipseTest {
// create, add and commit a file
IResource[] addedResources = buildResources(project, new String[] {"folder1/added.txt"}, false);
assertModificationState(project, new String[] {".", "folder1/", "folder1/added.txt"}, true);
- getProvider(project).add(addedResources, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(addedResources);
assertModificationState(project, new String[] {".", "folder1/", "folder1/added.txt"}, true);
commitResources(project, new String[] {"folder1/added.txt"});
assertModificationState(project, null, true);
@@ -299,7 +282,7 @@ public class IsModifiedTests extends EclipseTest {
assertModificationState(project, new String[] {".", "ignored.txt"}, true);
project.getFile(".cvsignore").create(new ByteArrayInputStream("ignored.txt".getBytes()), false, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", ".cvsignore"}, true);
- getProvider(project).add(new IResource[] {project.getFile(".cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile(".cvsignore")});
assertModificationState(project, new String[] {".", ".cvsignore"}, true);
commitResources(project, new String[] {".cvsignore"});
assertModificationState(project, null, true);
@@ -310,7 +293,7 @@ public class IsModifiedTests extends EclipseTest {
assertModificationState(project, new String[] {".", "ignored.txt"}, true);
// re-add the ignore and then delete the ignored
project.getFile(".cvsignore").create(new ByteArrayInputStream("ignored.txt".getBytes()), false, DEFAULT_MONITOR);
- getProvider(project).add(new IResource[] {project.getFile(".cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile(".cvsignore")});
assertModificationState(project, new String[] {".", ".cvsignore"}, true);
commitResources(project, new String[] {".cvsignore"});
assertModificationState(project, null, true);
@@ -319,7 +302,7 @@ public class IsModifiedTests extends EclipseTest {
// add the ignored file to version control
buildResources(project, new String[] {"ignored.txt"}, false);
assertModificationState(project, null, true);
- getProvider(project).add(new IResource[] {project.getFile("ignored.txt")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile("ignored.txt")});
assertModificationState(project, new String[] {".", "ignored.txt"}, true);
commitProject(project);
assertModificationState(project, null, true);
@@ -338,7 +321,7 @@ public class IsModifiedTests extends EclipseTest {
project.getFile("folder2/a.txt").copy(project.getFile("folder1/a.txt").getFullPath(), false, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", "folder1/", "folder1/a.txt", "folder2/", "folder2/a.txt"}, true);
// add the source, delete the destination and commit
- getProvider(project).add(new IResource[] {project.getFile("folder1/a.txt")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile("folder1/a.txt")});
project.getFile("folder2/a.txt").delete(false, DEFAULT_MONITOR);
commitProject(project);
assertModificationState(project, null, true);
@@ -348,7 +331,7 @@ public class IsModifiedTests extends EclipseTest {
// copy the destination back to the source
project.getFile("folder2/a.txt").copy(project.getFile("folder1/a.txt").getFullPath(), false, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", "folder2/", "folder2/a.txt"}, true);
- getProvider(project).add(new IResource[] {project.getFile("folder2/a.txt")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile("folder2/a.txt")});
commitProject(project);
assertModificationState(project, null, true);
}
@@ -358,7 +341,7 @@ public class IsModifiedTests extends EclipseTest {
// create a folder
project.getFolder("folder1/folder2").create(false, true, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", "folder1/", "folder1/folder2/"}, true);
- getProvider(project).add(new IResource[] {project.getFolder("folder1/folder2/")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFolder("folder1/folder2/")});
assertModificationState(project, null, true);
// create a folder
@@ -382,9 +365,9 @@ public class IsModifiedTests extends EclipseTest {
"folder1/folder2/folder3/add1.txt",
"folder1/folder2/folder3/folder4/"}, true);
// add to version control
- getProvider(project).add(new IResource[] {
+ addResources(new IResource[] {
project.getFile("folder1/folder2/folder3/add1.txt"),
- project.getFolder("folder1/folder2/folder3/folder4/")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ project.getFolder("folder1/folder2/folder3/folder4/")});
assertModificationState(project, new String[] {".", "folder1/", "folder1/folder2/", "folder1/folder2/folder3",
"folder1/folder2/folder3/add1.txt"}, true);
// commit
@@ -400,7 +383,7 @@ public class IsModifiedTests extends EclipseTest {
// ignore the folder
project.getFile("folder1/.cvsignore").create(new ByteArrayInputStream("ignored".getBytes()), false, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", "folder1/", "folder1/.cvsignore"}, true);
- getProvider(project).add(new IResource[] {project.getFile("folder1/.cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile("folder1/.cvsignore")});
assertModificationState(project, new String[] {".", "folder1/", "folder1/.cvsignore"}, true);
commitResources(project, new String[] {"folder1/.cvsignore"});
assertModificationState(project, null, true);
@@ -412,7 +395,7 @@ public class IsModifiedTests extends EclipseTest {
// re-add the .cvsignore and then delete the ignored
project.getFile("folder1/.cvsignore").create(new ByteArrayInputStream("ignored".getBytes()), false, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", "folder1/", "folder1/.cvsignore"}, true);
- getProvider(project).add(new IResource[] {project.getFile("folder1/.cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile("folder1/.cvsignore")});
commitResources(project, new String[] {"folder1/.cvsignore"});
assertModificationState(project, null, true);
project.getFolder("folder/ignored").delete(false, DEFAULT_MONITOR);
@@ -420,7 +403,7 @@ public class IsModifiedTests extends EclipseTest {
// add the ignored file to version control
buildResources(project, new String[] {"folder1/ignored/file.txt"}, false);
assertModificationState(project, null, true);
- getProvider(project).add(new IResource[] {project.getFile("folder1/ignored/file.txt")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile("folder1/ignored/file.txt")});
assertModificationState(project, new String[] {".", "folder1/", "folder1/ignored/", "folder1/ignored/file.txt"}, true);
commitProject(project);
assertModificationState(project, null, true);
@@ -474,7 +457,7 @@ public class IsModifiedTests extends EclipseTest {
project.getFolder("folder2/folder3/").copy(project.getFolder("folder1/folder3").getFullPath(), false, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", "folder1/", "folder1/folder3", "folder1/folder3/file.txt", "folder2/", "folder2/folder3/", "folder2/folder3/file.txt"}, true);
// add the source, delete the destination and commit
- getProvider(project).add(new IResource[] {project.getFile("folder1/folder3/file.txt")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile("folder1/folder3/file.txt")});
project.getFolder("folder2/folder3").delete(false, DEFAULT_MONITOR);
commitProject(project);
assertModificationState(project, null, true);
@@ -484,7 +467,7 @@ public class IsModifiedTests extends EclipseTest {
// copy the destination back to the source
project.getFolder("folder2/folder3/").copy(project.getFolder("folder1/folder3").getFullPath(), false, DEFAULT_MONITOR);
assertModificationState(project, new String[] {".", "folder2/", "folder2/folder3/", "folder2/folder3/file.txt"}, true);
- getProvider(project).add(new IResource[] {project.getFolder("folder2/folder3/")}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFolder("folder2/folder3/")});
commitProject(project);
assertModificationState(project, null, true);
}
@@ -501,14 +484,14 @@ public class IsModifiedTests extends EclipseTest {
addResources(copy, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, false);
setContentsAndEnsureModified(copy.getFile("changed.txt"));
setContentsAndEnsureModified(copy.getFile("merged.txt"));
- getProvider(copy).delete(new IResource[] {copy.getFile("deleted.txt")}, DEFAULT_MONITOR);
+ deleteResources(new IResource[] {copy.getFile("deleted.txt")});
assertModificationState(copy, new String[] {".", "added.txt", "folder2/", "folder2/added.txt", "changed.txt", "merged.txt", "deleted.txt"}, true);
- getProvider(copy).checkin(new IResource[] {copy}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ commitResources(new IResource[] {copy}, IResource.DEPTH_INFINITE);
assertModificationState(copy, null, true);
// update the project and check status
setContentsAndEnsureModified(project.getFile("merged.txt"));
- getProvider(project).update(new IResource[] {project}, Command.NO_LOCAL_OPTIONS, null, true /*createBackups*/, DEFAULT_MONITOR);
+ updateProject(project, null, false);
assertModificationState(project, new String[] {".", "merged.txt"}, true);
// can't commit because of merge
// commitProject(project);
@@ -524,7 +507,7 @@ public class IsModifiedTests extends EclipseTest {
assertModificationState(project, new String[] {".", "changed.txt"}, true);
// peform un update -C
- getProvider(project).update(new IResource[] {project}, new Command.LocalOption[] {Update.IGNORE_LOCAL_CHANGES}, null, true /*createBackups*/, DEFAULT_MONITOR);
+ updateProject(project, null, true /* ignore local changes */);
assertModificationState(project, null, true);
}
@@ -543,7 +526,7 @@ public class IsModifiedTests extends EclipseTest {
// Create a project and add a .cvsignore to it
IProject project = createProject("testIgnoredAfterCheckout", new String[] { ".changed.txt", "deleted.txt", "folder1/", "folder1/a.txt", "folder1/folder2/b.txt"});
project.getFile(".cvsignore").create(new ByteArrayInputStream("ignored".getBytes()), false, DEFAULT_MONITOR);
- getProvider(project).add(new IResource[] {project.getFile(".cvsignore")}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile(".cvsignore")});
commitProject(project);
assertModificationState(project, null, true);
project.getFolder("ignored").create(false, true, DEFAULT_MONITOR);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
index 7c5d3572b..7a9964e9e 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ModuleTest.java
@@ -125,7 +125,7 @@ public class ModuleTest extends EclipseTest {
ICVSFolder parent = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(project);
ICVSResource vcmmeta = CVSWorkspaceRoot.getCVSResourceFor(project.getFile(".vcm_meta"));
if ( ! vcmmeta.isManaged() && ! parent.getFolderSyncInfo().getIsStatic()) {
- getProvider(project).add(new IResource[] {project.getFile(".vcm_meta")}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ addResources(new IResource[] {project.getFile(".vcm_meta")});
waitMsec(1000);
commitProject(project);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
index 425187f62..ed7bd96eb 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/RemoteResourceTest.java
@@ -69,9 +69,9 @@ public class RemoteResourceTest extends EclipseTest {
IResource[] newResources = buildResources(copy, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, false);
setContentsAndEnsureModified(copy.getFile("changed.txt"));
CVSTeamProvider provider = getProvider(copy);
- provider.add(newResources, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
- provider.delete(new IResource[] {copy.getFile("deleted.txt")}, DEFAULT_MONITOR);
- provider.checkin(new IResource[] {copy}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ addResources(newResources);
+ deleteResources(new IResource[] {copy.getFile("deleted.txt")});
+ commitResources(new IResource[] {copy}, IResource.DEPTH_INFINITE);
// Build the remote tree from the original and ensure it matches the copy
RemoteFolderTree tree = RemoteFolderTreeBuilder.buildRemoteTree(getRepository(), project, CVSTag.DEFAULT, DEFAULT_MONITOR);
@@ -114,7 +114,7 @@ public class RemoteResourceTest extends EclipseTest {
// Checkout and modify a copy
IProject copy = checkoutCopy(project, "-copy");
addResources(copy, new String[] { "folder2/folder3/b.txt" }, false);
- getProvider(copy).checkin(new IResource[] {copy}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ commitResources(new IResource[] {copy}, IResource.DEPTH_INFINITE);
// Build the remote tree from the project
RemoteFolderTree tree = RemoteFolderTreeBuilder.buildRemoteTree(getRepository(), project, CVSTag.DEFAULT, DEFAULT_MONITOR);
@@ -136,8 +136,8 @@ public class RemoteResourceTest extends EclipseTest {
IProject copy = checkoutCopy(project, "-copy");
setContentsAndEnsureModified(copy.getFile("folder2/folder3/c.txt"));
addResources(copy, new String[] { "folder2/folder3/add.txt" }, false);
- getProvider(copy).delete(new IResource[] {copy.getFile("folder2/folder3/b.txt")}, DEFAULT_MONITOR);
- getProvider(copy).checkin(new IResource[] {copy}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ deleteResources(new IResource[] {copy.getFile("folder2/folder3/b.txt")});
+ commitResources(new IResource[] {copy}, IResource.DEPTH_INFINITE);
// Build the remote tree from the project
RemoteFolderTree tree = RemoteFolderTreeBuilder.buildRemoteTree(getRepository(), project.getFolder("folder2"), CVSTag.DEFAULT, DEFAULT_MONITOR);
@@ -174,7 +174,7 @@ public class RemoteResourceTest extends EclipseTest {
file.setContents(getRandomContents(), false, false, null);
addResources(project, new String[] { "folder2/folder3/add.txt" }, false);
deleteResources(project, new String[] {"folder1/b.txt"}, false);
- getProvider(project).checkin(new IResource[] {project}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ commitResources(new IResource[] {project}, IResource.DEPTH_INFINITE);
// Fetch the remote tree for the version
ICVSRemoteResource tree = CVSWorkspaceRoot.getRemoteTree(project, v1Tag, DEFAULT_MONITOR);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java
index 8cdcea0bf..625185247 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/provider/ResourceDeltaTest.java
@@ -154,7 +154,7 @@ public class ResourceDeltaTest extends EclipseTest {
IFolder folder = project.getFolder("newfolder");
folder.create(false, true, null);
assertAdditionMarkerFor(folder, true);
- getProvider(project).add(new IResource[] {folder}, IResource.DEPTH_ZERO, DEFAULT_MONITOR);
+ addResources(new IResource[] {folder});
assertAdditionMarkerFor(folder, false);
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
index 0b01cf083..94dcc359d 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSMergeSubscriberTest.java
@@ -23,7 +23,6 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.tests.ccvs.core.CVSTestSetup;
@@ -54,8 +53,7 @@ public class CVSMergeSubscriberTest extends CVSSyncSubscriberTest {
IProject copy = checkoutCopy(project, "-copy");
tagProject(project, root, false);
tagProject(project, branch, false);
- getProvider(copy).update(new IResource[] {copy}, Command.NO_LOCAL_OPTIONS,
- branch, false /*createBackups*/, DEFAULT_MONITOR);
+ updateProject(copy, branch, false);
return copy;
}
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
index ebf74c5f7..e71319bf0 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java
@@ -27,7 +27,6 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.ISubscriberChangeEvent;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ccvs.core.*;
-import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
@@ -930,7 +929,7 @@ public class CVSWorkspaceSubscriberTest extends CVSSyncSubscriberTest {
IProject project = createProject(new String[] { "file1.txt", "file2.txt", "file3.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"});
CVSTag branch = new CVSTag("branch1", CVSTag.BRANCH);
tagProject(project, branch, false /* force */);
- getProvider(project).update(new IResource[] {project}, Command.NO_LOCAL_OPTIONS, branch, true /*createBackups*/, DEFAULT_MONITOR);
+ updateProject(project, branch, false);
// Checkout and modify a copy
IProject copy = checkoutCopy(project, branch);
diff --git a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java
index d0c86cfa4..b21b745d0 100644
--- a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java
+++ b/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CompareOperationTests.java
@@ -139,7 +139,7 @@ public class CompareOperationTests extends CVSOperationTest {
setContentsAndEnsureModified(copy.getFile("folder1/a.txt"));
addResources(copy, new String[] { "folder1/newFile", "folder2/folder3/add.txt" }, false);
deleteResources(copy, new String[] {"folder1/b.txt"}, false);
- getProvider(copy).checkin(new IResource[] {copy}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR);
+ commitResources(new IResource[] {copy}, IResource.DEPTH_INFINITE);
// Run the compare operation of the project folder
ICVSRemoteResource remoteResource = CVSWorkspaceRoot.getRemoteResourceFor(project);

Back to the top