コード例 #1
0
ファイル: CvsRepository.java プロジェクト: tordf/Greenfoot
  /**
   * 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;
  }
コード例 #2
0
ファイル: CvsRepository.java プロジェクト: tordf/Greenfoot
  /**
   * Get the response of a "dummy run" update command. The response contains a list of files, which
   * need to be updated or are locally modified etc.
   */
  private UpdateServerResponse getUpdateServerResponse(Client client, String path)
      throws CommandException, CommandAbortedException, AuthenticationException {
    // setupConnection();
    // Client client = getClient();
    setupConnection(client);

    UpdateCommand updateCommand = new UpdateCommand();
    UpdateServerResponse updateServerResponse = new UpdateServerResponse(null, null);
    GlobalOptions globalOptions = new GlobalOptions();

    updateCommand.setRecursive(true);
    updateCommand.setBuildDirectories(true);
    updateCommand.setPruneDirectories(true);
    updateCommand.setCleanCopy(false);
    globalOptions.setCVSRoot(cvsroot.toString());

    globalOptions.setDoNoChanges(true); // -n
    globalOptions.setModeratelyQuiet(true); // -q
    client.setLocalPath(path);
    client.getEventManager().addCVSListener(updateServerResponse);

    // System.out.println("dir: " + client.getLocalPath());
    // System.out.println("globalOptions: " + globalOptions.getCVSCommand());
    printCommand(updateCommand, client);

    // Debug.message("Update command = " + updateCommand.getCVSCommand());
    try {
      client.executeCommand(updateCommand, globalOptions);
      updateServerResponse.waitForExecutionToFinish();
    } finally {
      client.getEventManager().removeCVSListener(updateServerResponse);
      disconnect(client);
    }

    return updateServerResponse;
  }