Beispiel #1
0
  /**
   * Get status of all the given files. Returns a List of TeamStatusInfo.
   *
   * @param files The files whose status to retrieve
   * @param remoteDirs These are the directories which we know are in the repository. Any file in
   *     the files list which does not exist locally but for which the containing directory is in
   *     the repository, should have that directory listed here.
   * @throws CommandAbortedException
   * @throws CommandException
   * @throws AuthenticationException
   * @throws InvalidCvsRootException
   */
  public synchronized StatusServerResponse getStatus(Client client, Set files, Set remoteDirs)
      throws CommandAbortedException, CommandException, AuthenticationException {
    // setupConnection();
    // Client client = getClient();
    setupConnection(client);

    // Now we can use the cvs "status" command to get status on the
    // remaining files.

    StatusCommand statusCommand = new StatusCommand();
    statusCommand.setFiles(listToFileArray(files));

    StatusServerResponse statusServerResponse = new StatusServerResponse();
    client.getEventManager().addCVSListener(statusServerResponse);

    client.setLocalPath(projectPath.getAbsolutePath());
    printCommand(statusCommand, client);
    adminHandler.setMildManneredMode(true);

    try {
      client.executeCommand(statusCommand, globalOptions);
      statusServerResponse.waitForExecutionToFinish();
    } finally {
      adminHandler.setMildManneredMode(false);
      client.getEventManager().removeCVSListener(statusServerResponse);
      disconnect(client);
    }

    return statusServerResponse;
  }
Beispiel #2
0
  /**
   * Update the listed files from the repository
   *
   * @param client The client to use to perform the update with
   * @param listener The listener to receive notifications of updated files
   * @param theFiles The set of files to update
   * @param force Whether to do a forced "clean copy" update (override local changes)
   * @return UpdateServerResponse with information about the update
   * @throws CommandAbortedException
   * @throws CommandException
   * @throws AuthenticationException
   * @throws InvalidCvsRootException
   */
  synchronized UpdateServerResponse doUpdateFiles(
      BlueJCvsClient client, UpdateListener listener, Set theFiles, boolean force)
      throws CommandAbortedException, CommandException, AuthenticationException {
    UpdateCommand command = new UpdateCommand();
    command.setFiles(listToFileArray(theFiles));

    command.setCleanCopy(force);
    command.setRecursive(false);
    command.setBuildDirectories(true);
    command.setPruneDirectories(true);

    UpdateServerResponse updateServerResponse = new UpdateServerResponse(listener, client);
    client.getEventManager().addCVSListener(updateServerResponse);
    client.setLocalPath(projectPath.getAbsolutePath());

    printCommand(command, client);
    setupConnection(client);

    try {
      adminHandler.setMildManneredMode(true);
      client.executeCommand(command, globalOptions);
      updateServerResponse.waitForExecutionToFinish();
    } finally {
      // restore previous excludes setting
      client.getEventManager().removeCVSListener(updateServerResponse);
      disconnect(client);
      adminHandler.setMildManneredMode(false);
    }

    updateServerResponse.setConflictMap(client.getConflictFiles());
    return updateServerResponse;
  }
Beispiel #3
0
  /**
   * Remove the files in an array of Files from the repository.
   *
   * @param files the files to remove.
   * @throws CommandException
   * @throws CommandAbortedException
   * @throws AuthenticationException
   * @throws InvalidCvsRootException
   */
  BasicServerResponse removeFromRepository(Client client, Collection files)
      throws CommandException, CommandAbortedException, AuthenticationException {
    BasicServerResponse basicServerResponse = new BasicServerResponse();

    if (files.size() < 1) {
      basicServerResponse.commandTerminated(null);
      return basicServerResponse;
    }

    setupConnection(client);
    // setupConnection();
    // Client client = getClient();

    RemoveCommand removeCommand = new RemoveCommand();
    removeCommand.setFiles(listToFileArray(files));

    client.getEventManager().addCVSListener(basicServerResponse);
    client.setLocalPath(projectPath.getAbsolutePath());

    printCommand(removeCommand, client);
    try {
      adminHandler.setMildManneredMode(true);
      client.executeCommand(removeCommand, globalOptions);
      basicServerResponse.waitForExecutionToFinish();
    } finally {
      client.getEventManager().removeCVSListener(basicServerResponse);
      disconnect(client);
      adminHandler.setMildManneredMode(false);
    }

    return basicServerResponse;
  }
Beispiel #4
0
 /**
  * Find the remote directories which also exist locally, but are not locally under version
  * control.
  */
 public synchronized Set getRemoteDirs(Client client)
     throws AuthenticationException, CommandException {
   adminHandler.setMildManneredMode(true);
   Set remoteDirs = new HashSet();
   try {
     getRemoteFiles(client, null, projectPath, remoteDirs, true);
   } finally {
     adminHandler.setMildManneredMode(false);
   }
   return remoteDirs;
 }
Beispiel #5
0
 /**
  * Get a list of files which are in the repository, but which are not in the local project. This
  * includes both files which have been locally deleted, and files which have been added to the
  * repository from another location.
  *
  * @param remoteDirs This set will have all remote directories which are found added to it.
  * @throws InvalidCvsRootException
  * @throws AuthenticationException
  * @throws CommandException
  */
 public synchronized List getRemoteFiles(Client client, Set remoteDirs)
     throws AuthenticationException, CommandException {
   List files = new LinkedList();
   adminHandler.setMildManneredMode(true);
   try {
     getRemoteFiles(client, files, projectPath, remoteDirs, false);
   } finally {
     adminHandler.setMildManneredMode(false);
   }
   return files;
 }