Search in sources :

Example 11 with Requests

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);
    }
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) IOException(java.io.IOException) AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 12 with Requests

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);
    }
}
Also used : ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) ICvsFiles(org.netbeans.lib.cvsclient.command.ICvsFiles) IOException(java.io.IOException) Requests(org.netbeans.lib.cvsclient.request.Requests) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 13 with Requests

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);
                }
            }
        }
    }
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) IOException(java.io.IOException) Requests(org.netbeans.lib.cvsclient.request.Requests)

Example 14 with Requests

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);
    }
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) ICvsListener(org.netbeans.lib.cvsclient.event.ICvsListener) Requests(org.netbeans.lib.cvsclient.request.Requests)

Example 15 with Requests

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());
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) IOException(java.io.IOException) DirectoryRequest(org.netbeans.lib.cvsclient.request.DirectoryRequest) Requests(org.netbeans.lib.cvsclient.request.Requests) File(java.io.File)

Aggregations

Requests (org.netbeans.lib.cvsclient.request.Requests)24 IOException (java.io.IOException)18 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)11 IOCommandException (org.netbeans.lib.cvsclient.command.IOCommandException)10 DummyRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler)10 ICvsFiles (org.netbeans.lib.cvsclient.command.ICvsFiles)8 RangeProgressViewer (org.netbeans.lib.cvsclient.progress.RangeProgressViewer)6 IRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.IRequestsProgressHandler)6 DualListener (org.netbeans.lib.cvsclient.event.DualListener)5 FileStateRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.FileStateRequestsProgressHandler)5 FileInfoAndMessageResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndMessageResponseProgressHandler)4 AbstractFileObject (org.netbeans.lib.cvsclient.file.AbstractFileObject)2 DirectoryRequest (org.netbeans.lib.cvsclient.request.DirectoryRequest)2 ExpandModulesRequest (org.netbeans.lib.cvsclient.request.ExpandModulesRequest)2 File (java.io.File)1 LogMessageParser (org.netbeans.lib.cvsclient.command.log.LogMessageParser)1 FileInfoAndDirectoryResponseProgressHandler (org.netbeans.lib.cvsclient.progress.receiving.FileInfoAndDirectoryResponseProgressHandler)1