1. /*
  2. * Copyright 2002-2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant.taskdefs.optional.vss;
  18. import org.apache.tools.ant.BuildException;
  19. import org.apache.tools.ant.types.Commandline;
  20. /**
  21. * Performs CP (Change Project) commands to Microsoft Visual SourceSafe.
  22. * <p>This task is typically used before a VssAdd in order to set the target project</p>
  23. *
  24. * @ant.task name="vsscp" category="scm"
  25. */
  26. public class MSVSSCP extends MSVSS {
  27. /**
  28. * Builds a command line to execute ss.
  29. * @return The constructed commandline.
  30. */
  31. protected Commandline buildCmdLine() {
  32. Commandline commandLine = new Commandline();
  33. // first off, make sure that we've got a command and a vssdir ...
  34. if (getVsspath() == null) {
  35. String msg = "vsspath attribute must be set!";
  36. throw new BuildException(msg, getLocation());
  37. }
  38. // build the command line from what we got the format is
  39. // ss CP VSS items [-H] [-I-] [-Y] [-?]
  40. // as specified in the SS.EXE help
  41. commandLine.setExecutable(getSSCommand());
  42. commandLine.createArgument().setValue(COMMAND_CP);
  43. // VSS items
  44. commandLine.createArgument().setValue(getVsspath());
  45. // -I- or -I-Y or -I-N
  46. commandLine.createArgument().setValue(getAutoresponse());
  47. // -Y
  48. commandLine.createArgument().setValue(getLogin());
  49. return commandLine;
  50. }
  51. /**
  52. * Autoresponce behaviour. Valid options are Y and N.
  53. *
  54. * @param response The auto response value.
  55. */
  56. public void setAutoresponse(String response) {
  57. super.setInternalAutoResponse(response);
  58. }
  59. }