use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.
the class AddCommand method execute.
// Implemented ============================================================
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
BugLog.getInstance().assertTrue(getFileObjects().size() > 0, "No file specified.");
repositoryPathToDirectoryObject.clear();
final Requests requests;
try {
requests = new Requests(CommandRequest.ADD, clientEnvironment);
requests.addArgumentRequest(getKeywordSubst(), "-k");
for (AbstractFileObject abstractFileObject : getFileObjects()) {
addRequests(abstractFileObject, requests, requestProcessor, clientEnvironment);
}
requests.addLocalPathDirectoryRequest();
addArgumentRequests(requests);
} catch (IOException ex) {
throw new IOCommandException(ex);
}
final ICvsListener parser = new AddParser(eventManager, clientEnvironment.getCvsFileSystem());
parser.registerListeners(listenerRegistry);
try {
final boolean result = requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
createCvsDirectories(clientEnvironment);
return result;
} catch (IOException ex) {
throw new IOCommandException(ex);
} finally {
repositoryPathToDirectoryObject.clear();
parser.unregisterListeners(listenerRegistry);
}
}
use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.
the class AnnotateCommand method execute.
// Implemented ============================================================
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
final ICvsFiles cvsFiles;
try {
cvsFiles = scanFileSystem(clientEnvironment);
} catch (IOException ex) {
throw new IOCommandException(ex);
}
final Requests requests = new Requests(CommandRequest.ANNOTATE, clientEnvironment);
requests.addArgumentRequest(isUseHeadIfNotFound(), "-f");
requests.addArgumentRequest(getDate(), "-D");
requests.addArgumentRequest(getRevisionOrTag(), "-r");
requests.addArgumentRequest(isAnnotateBinary(), "-F");
addFileRequests(cvsFiles, requests, clientEnvironment);
requests.addLocalPathDirectoryRequest();
addArgumentRequests(requests);
final ICvsListener parser = new AnnotateMessageParser(eventManager, clientEnvironment.getCvsFileSystem());
parser.registerListeners(listenerRegistry);
try {
return requestProcessor.processRequests(requests, FileStateRequestsProgressHandler.create(progressViewer, cvsFiles));
} finally {
parser.unregisterListeners(listenerRegistry);
}
}
use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.
the class CheckoutCommand method checkout.
private boolean checkout(ExpandedModules expandedModules, IRequestProcessor requestProcessor, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment) throws CommandException, AuthenticationException {
// we first see whether the modules specified actually exist
// checked out already. If so, we must work something like an update
// command and send modified files to the server.
processExistingModules(expandedModules, clientEnvironment);
final ICvsFiles cvsFiles;
try {
if (getFileObjects().size() > 0) {
cvsFiles = scanFileSystem(clientEnvironment);
} else {
cvsFiles = null;
}
} catch (IOException ex) {
throw new IOCommandException(ex);
}
final Requests requests = new Requests(CommandRequest.CHECKOUT, clientEnvironment);
if (getAlternativeCheckoutDirectory() != null) {
requests.addArgumentRequest("-d");
requests.addArgumentRequest(getAlternativeCheckoutDirectory());
}
requests.addArgumentRequest(!isRecursive(), "-l");
requests.addArgumentRequest(isResetStickyOnes(), "-A");
requests.addArgumentRequest(isUseHeadIfNotFound(), "-f");
requests.addArgumentRequest(getUpdateByDate(), "-D");
requests.addArgumentRequest(getUpdateByRevisionOrTag(), "-r");
requests.addArgumentRequest(getKeywordSubstitution(), "-k");
requests.addArgumentRequest(isPrintToOutput(), "-p");
if (cvsFiles != null) {
addFileRequests(cvsFiles, requests, clientEnvironment);
}
addModuleArguments(requests);
requests.addLocalPathDirectoryRequest();
final DirectoryPruner directoryPruner;
if (isPruneDirectories()) {
directoryPruner = new DirectoryPruner(clientEnvironment);
} else {
directoryPruner = null;
}
if (directoryPruner != null) {
directoryPruner.registerListeners(listenerRegistry);
}
try {
return requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
} finally {
try {
if (myAfterCheckout != null) {
myAfterCheckout.run();
}
} finally {
if (directoryPruner != null) {
directoryPruner.unregisterListeners(listenerRegistry);
try {
directoryPruner.pruneEmptyDirectories();
} catch (IOException ex) {
throw new IOCommandException(ex);
}
}
}
}
}
use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.
the class ListModulesCommand method execute.
// Implemented ============================================================
@Override
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
modules.clear();
final Requests requests = new Requests(CommandRequest.CHECKOUT, clientEnvironment);
requests.addArgumentRequest("-N");
requests.addArgumentRequest("-c");
requests.addDirectoryRequest(DirectoryObject.createInstance("/"));
final ICvsListener listener = new GetModulesParser();
listener.registerListeners(listenerRegistry);
try {
return requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
} finally {
listener.unregisterListeners(listenerRegistry);
}
}
use of org.netbeans.lib.cvsclient.request.Requests in project intellij-community by JetBrains.
the class ImportCommand method execute.
// Implemented ============================================================
public boolean execute(IRequestProcessor requestProcessor, IEventSender eventManager, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
// check necessary fields
BugLog.getInstance().assertNotNull(getModule());
BugLog.getInstance().assertNotNull(getReleaseTag());
BugLog.getInstance().assertNotNull(getVendorTag());
final Requests requests;
try {
requests = new Requests(CommandRequest.IMPORT, clientEnvironment);
requests.addArgumentRequest(getVendorBranchNotNull(), "-b");
requests.addMessageRequests(CommandUtils.getMessageNotNull(getLogMessage()));
requests.addArgumentRequest(getKeywordSubstitutionOption(), "-k");
addWrapperRequests(requests, this.wrapperMap);
requests.addArgumentRequest(getModule());
requests.addArgumentRequest(getVendorTag());
requests.addArgumentRequest(getReleaseTag());
final File rootDirectory = clientEnvironment.getCvsFileSystem().getLocalFileSystem().getRootDirectory();
addFileRequests(rootDirectory, requests, requestProcessor, clientEnvironment);
// This is necessary when importing a directory structure with CVS directories.
// If requests.addLocalPathDirectoryRequest(); would be used, the repository path
// would be used from the CVS folders.
requests.addRequest(new DirectoryRequest(".", getRepositoryRoot(clientEnvironment)));
} catch (IOException ex) {
throw new IOCommandException(ex);
}
return requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
}
Aggregations