Search in sources :

Example 6 with DummyRequestsProgressHandler

use of org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler 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 7 with DummyRequestsProgressHandler

use of org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler 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 8 with DummyRequestsProgressHandler

use of org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler 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)

Example 9 with DummyRequestsProgressHandler

use of org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler in project intellij-community by JetBrains.

the class CreateModuleCommand 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(module);
    final String repositoryRoot = FileUtils.removeTrailingSlash(clientEnvironment.getCvsRoot().getRepositoryPath()) + '/' + module;
    final Requests requests = new Requests(CommandRequest.IMPORT, clientEnvironment);
    requests.addArgumentRequest("-b");
    requests.addArgumentRequest("1.1.1");
    requests.addMessageRequests("Create module");
    requests.addArgumentRequest(module);
    requests.addArgumentRequest("vendor-tag");
    requests.addArgumentRequest("release-tag");
    requests.addRequest(new DirectoryRequest(".", repositoryRoot));
    if (!requestProcessor.processRequests(requests, new DummyRequestsProgressHandler())) {
        return false;
    }
    try {
        createCvsDirectory(clientEnvironment, repositoryRoot);
    } catch (IOException ex) {
        throw new IOCommandException(ex);
    }
    return true;
}
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) IOCommandException(org.netbeans.lib.cvsclient.command.IOCommandException)

Example 10 with DummyRequestsProgressHandler

use of org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler in project intellij-community by JetBrains.

the class RtagCommand method execute.

public final boolean execute(IRequestProcessor requestProcessor, IEventSender eventSender, ICvsListenerRegistry listenerRegistry, IClientEnvironment clientEnvironment, IProgressViewer progressViewer) throws CommandException, AuthenticationException {
    final Requests requests = new Requests(CommandRequest.RTAG, clientEnvironment);
    requests.addArgumentRequest(myOverrideExistings, "-F");
    requests.addArgumentRequest(true, myTagName);
    for (AbstractFileObject fileObject : getFileObjects()) {
        String path = fileObject.getPath();
        if (StringUtil.startsWithChar(path, '/'))
            path = path.substring(1);
        requests.addArgumentRequest(path);
    }
    return requestProcessor.processRequests(requests, new DummyRequestsProgressHandler());
}
Also used : DummyRequestsProgressHandler(org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler) AbstractFileObject(org.netbeans.lib.cvsclient.file.AbstractFileObject) Requests(org.netbeans.lib.cvsclient.request.Requests)

Aggregations

DummyRequestsProgressHandler (org.netbeans.lib.cvsclient.progress.sending.DummyRequestsProgressHandler)10 Requests (org.netbeans.lib.cvsclient.request.Requests)10 IOException (java.io.IOException)4 ICvsListener (org.netbeans.lib.cvsclient.event.ICvsListener)3 IOCommandException (org.netbeans.lib.cvsclient.command.IOCommandException)2 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