/** * 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; }
/** * Add an array of Files/directories to the repository. Parent directories must be specified * before the sub-directories/files they contain. * * @param files the files to add * @param binary true if the added files should be treated as binary * @throws CommandException * @throws CommandAbortedException * @throws AuthenticationException * @throws InvalidCvsRootException */ BasicServerResponse addToRepository(Client client, File[] files, boolean binary) throws CommandException, CommandAbortedException, AuthenticationException { BasicServerResponse basicServerResponse = new BasicServerResponse(); // If there's nothing to add, return immediately if (files.length < 1) { basicServerResponse.commandTerminated(null); return basicServerResponse; } setupConnection(client); // setupConnection(); // Client client = getClient(); AddCommand addCommand = new AddCommand(); addCommand.setFiles(files); KeywordSubstitutionOptions kso; if (binary) { kso = KeywordSubstitutionOptions.BINARY; } else { kso = KeywordSubstitutionOptions.DEFAULT; } addCommand.setKeywordSubst(kso); client.getEventManager().addCVSListener(basicServerResponse); client.setLocalPath(projectPath.toString()); printCommand(addCommand, client); try { client.executeCommand(addCommand, globalOptions); basicServerResponse.waitForExecutionToFinish(); } finally { client.getEventManager().removeCVSListener(basicServerResponse); disconnect(client); } return basicServerResponse; }