public TfsCommand createCommand(ScmProviderRepository r, ScmFileSet f, boolean recursive) {
   TfsCommand command = new TfsCommand("dir", r, f, getLogger());
   if (recursive) {
     command.addArgument("-recursive");
   }
   command.addArgument(f);
   return command;
 }
  public TfsCommand createCommand(
      ScmProviderRepository r, ScmFileSet f, String tag, ScmTagParameters scmTagParameters) {
    TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
    String url = tfsRepo.getServerPath();

    TfsCommand command = new TfsCommand("label", r, f, getLogger());
    command.addArgument(tag);
    command.addArgument(url);
    command.addArgument("-recursive");
    command.addArgument("-child:replace");
    String message = scmTagParameters.getMessage();
    if (message != null && !message.equals("")) {
      command.addArgument("-comment:" + message);
    }
    return command;
  }
  protected ListScmResult executeListCommand(
      ScmProviderRepository r, ScmFileSet f, boolean recursive, ScmVersion v) throws ScmException {
    FileListConsumer out = new ServerFileListConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();

    TfsCommand command = createCommand(r, f, recursive);
    int status = command.execute(out, err);
    if (status != 0 || err.hasBeenFed()) {
      return new ListScmResult(
          command.getCommandString(),
          "Error code for TFS list command - " + status,
          err.getOutput(),
          false);
    }

    return new ListScmResult(command.getCommandString(), out.getFiles());
  }
  protected ScmResult executeTagCommand(
      ScmProviderRepository r, ScmFileSet f, String tag, ScmTagParameters scmTagParameters)
      throws ScmException {
    TfsCommand command = createCommand(r, f, tag, scmTagParameters);

    StringStreamConsumer out = new StringStreamConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();

    int status = command.execute(out, err);
    if (status != 0 || err.hasBeenFed()) {
      return new TagScmResult(
          command.getCommandString(),
          "Error code for TFS label command - " + status,
          err.getOutput(),
          false);
    }
    List<ScmFile> files = new ArrayList<ScmFile>(f.getFileList().size());
    for (File file : f.getFileList()) {
      files.add(new ScmFile(file.getPath(), ScmFileStatus.TAGGED));
    }
    return new TagScmResult(command.getCommandString(), files);
  }