1. /*
  2. * Copyright 2001-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. import org.apache.tools.ant.types.Path;
  21. /**
  22. * Performs CheckIn commands to Microsoft Visual SourceSafe.
  23. *
  24. *
  25. * @ant.task name="vsscheckin" category="scm"
  26. */
  27. public class MSVSSCHECKIN extends MSVSS {
  28. /**
  29. * Builds a command line to execute ss.
  30. * @return The constructed commandline.
  31. */
  32. protected Commandline buildCmdLine() {
  33. Commandline commandLine = new Commandline();
  34. // first off, make sure that we've got a command and a vssdir ...
  35. if (getVsspath() == null) {
  36. String msg = "vsspath attribute must be set!";
  37. throw new BuildException(msg, getLocation());
  38. }
  39. // build the command line from what we got the format is
  40. // ss Checkin VSS items [-H] [-C] [-I-] [-N] [-O] [-R] [-W] [-Y] [-?]
  41. // as specified in the SS.EXE help
  42. commandLine.setExecutable(getSSCommand());
  43. commandLine.createArgument().setValue(COMMAND_CHECKIN);
  44. // VSS items
  45. commandLine.createArgument().setValue(getVsspath());
  46. // -GL
  47. commandLine.createArgument().setValue(getLocalpath());
  48. // -I- or -I-Y or -I-N
  49. commandLine.createArgument().setValue(getAutoresponse());
  50. // -R
  51. commandLine.createArgument().setValue(getRecursive());
  52. // -W
  53. commandLine.createArgument().setValue(getWritable());
  54. // -Y
  55. commandLine.createArgument().setValue(getLogin());
  56. // -C
  57. commandLine.createArgument().setValue(getComment());
  58. return commandLine;
  59. }
  60. /**
  61. * Override the project working directory.
  62. *
  63. * @param localPath The path on disk.
  64. */
  65. public void setLocalpath(Path localPath) {
  66. super.setInternalLocalPath(localPath.toString());
  67. }
  68. /**
  69. * Check-in files recursively. Defaults to false.
  70. *
  71. * @param recursive The boolean value for recursive.
  72. */
  73. public void setRecursive(boolean recursive) {
  74. super.setInternalRecursive(recursive);
  75. }
  76. /**
  77. * Unset the READ-ONLY flag on local copies of files checked-in to VSS.
  78. * Defaults to false.
  79. *
  80. * @param writable The boolean value for writable.
  81. */
  82. public final void setWritable(boolean writable) {
  83. super.setInternalWritable(writable);
  84. }
  85. /**
  86. * Autoresponce behaviour. Valid options are Y and N.
  87. *
  88. * @param response The auto response value.
  89. */
  90. public void setAutoresponse(String response) {
  91. super.setInternalAutoResponse(response);
  92. }
  93. /**
  94. * Comment to apply to files checked-in to SourceSafe.
  95. *
  96. * @param comment The comment to apply in SourceSafe
  97. */
  98. public void setComment(String comment) {
  99. super.setInternalComment(comment);
  100. }
  101. }