diff options
author | Michael Valenta | 2002-02-12 13:40:58 +0000 |
---|---|---|
committer | Michael Valenta | 2002-02-12 13:40:58 +0000 |
commit | e9bcc1e6a32087b8c0afc65ea506087a2ea6a287 (patch) | |
tree | b46bb2b3a5c94895aaef308c5f91f1f021cdf361 | |
parent | 5b3db7bc250ea1e3ed4d083754aaca6955caff31 (diff) | |
download | eclipse.platform.team-e9bcc1e6a32087b8c0afc65ea506087a2ea6a287.tar.gz eclipse.platform.team-e9bcc1e6a32087b8c0afc65ea506087a2ea6a287.tar.xz eclipse.platform.team-e9bcc1e6a32087b8c0afc65ea506087a2ea6a287.zip |
Added RTAG command
3 files changed, 83 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java index 11be5f786..a74ce6513 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java @@ -46,6 +46,7 @@ public abstract class Command { public final static Remove REMOVE = new Remove(); public final static Status STATUS = new Status(); public final static Tag TAG = new Tag(); + public final static RTag RTAG = new RTag(); public final static Update UPDATE = new Update(); final static ValidRequests VALID_REQUESTS = new ValidRequests(); diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java new file mode 100644 index 000000000..933a9464d --- /dev/null +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/RTag.java @@ -0,0 +1,81 @@ +package org.eclipse.team.internal.ccvs.core.client; + +/* + * (c) Copyright IBM Corp. 2000, 2002. + * All Rights Reserved. + */ + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.team.ccvs.core.CVSTag; +import org.eclipse.team.ccvs.core.ICVSRemoteResource; +import org.eclipse.team.internal.ccvs.core.CVSException; +import org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption; +import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; +import org.eclipse.team.internal.ccvs.core.resources.ICVSResource; + +public class RTag extends Command { + /*** Local options: specific to tag ***/ + public static final LocalOption CREATE_BRANCH = Tag.CREATE_BRANCH; + + /** + * Makes a -r or -D option for a tag. + * Valid for: checkout export history rdiff update + */ + public static LocalOption makeTagOption(CVSTag tag) { + int type = tag.getType(); + switch (type) { + case CVSTag.BRANCH: + case CVSTag.VERSION: + case CVSTag.HEAD: + return new LocalOption("-r", tag.getName()); //$NON-NLS-1$ + case CVSTag.DATE: + return new LocalOption("-D", tag.getName()); //$NON-NLS-1$ + default: + // Unknow tag type!!! + throw new IllegalArgumentException(); + } + } + + protected RTag() { } + protected String getCommandId() { + return "rtag"; //$NON-NLS-1$ + } + + protected ICVSResource[] computeWorkResources(Session session, LocalOption[] localOptions, + String[] arguments) throws CVSException { + if (arguments.length < 2) throw new IllegalArgumentException(); + return new ICVSResource[0]; + } + + protected void sendLocalResourceState(Session session, GlobalOption[] globalOptions, + LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor) + throws CVSException { + } + + public IStatus execute(Session session, GlobalOption[] globalOptions, + LocalOption[] localOptions, CVSTag tag, String name, ICVSResource[] resources, + IProgressMonitor monitor) throws CVSException { + + // Add the source tag to the local options + List modifiedLocalOptions = new ArrayList(localOptions.length + 1); + if (tag==null) tag = CVSTag.DEFAULT; + modifiedLocalOptions.addAll(Arrays.asList(localOptions)); + modifiedLocalOptions.add(makeTagOption(tag)); + + // Build the arguments from the parameters + List arguments = new ArrayList(resources.length + 1); + arguments.add(name); + for (int i = 0; i < resources.length; i++) { + ICVSResource resource = resources[i]; + arguments.add(resource.getRemoteLocation(null)); + } + return super.execute(session, globalOptions, + (LocalOption[]) modifiedLocalOptions.toArray(new LocalOption[modifiedLocalOptions.size()]), + (String[]) arguments.toArray(new String[arguments.size()]), null, monitor); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties index f64528717..8f420a316 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties @@ -77,6 +77,7 @@ RemoteFolder.errorFetchingRevisions=Error fetching file revision numbers RemoteFolder.invalidChild=Resource {0} is not a child of folder {1} RemoteManagedResource.invalidOperation=Invalid operation performed on remote resource RemoteManagedFolder.invalidChild=Invalid folder {0} received during remote operation +RemoteFile.noContentsReceived=No contents received from server for {0} Command.server=Contacting server Command.receivingResponses=Receiving server response |