Search in sources :

Example 6 with CvsRootProvider

use of com.intellij.cvsSupport2.connections.CvsRootProvider in project intellij-community by JetBrains.

the class GetModuleContentOperation method createGetModuleContentOperation.

private LocalPathIndifferentOperation createGetModuleContentOperation(RepositoryPathProvider adminWriter, CvsEnvironment environment, final String moduleName) {
    final LocalPathIndifferentOperation operation = new LocalPathIndifferentOperation(new AdminReaderOnStoredRepositoryPath(adminWriter), environment) {

        private boolean myIsInModule = false;

        @Override
        protected Command createCommand(CvsRootProvider root, CvsExecutionEnvironment cvsExecutionEnvironment) {
            final CheckoutCommand result = new CheckoutCommand(null);
            result.addModule(moduleName);
            result.setRecursive(true);
            return result;
        }

        @Override
        protected ILocalFileReader createLocalFileReader() {
            return ConstantLocalFileReader.FOR_EXISTING_FILE;
        }

        @Override
        protected String getOperationName() {
            return "checkout";
        }

        @Override
        protected ILocalFileWriter createLocalFileWriter(String cvsRoot, UpdatedFilesManager mergedFilesCollector, CvsExecutionEnvironment cvsExecutionEnvironment) {
            return DeafLocalFileWriter.INSTANCE;
        }

        @Override
        public void messageSent(String message, final byte[] byteMessage, boolean error, boolean tagged) {
            super.messageSent(message, byteMessage, error, tagged);
            myStreamingDirectoryContentListener.setModulePath(myAdminWriterStoringRepositoryPath.getModulePath());
            final Matcher matcher = UPDATING_PATTERN.matcher(message);
            if (matcher.matches()) {
                if (myModuleLocation != null && myModuleLocation.equals(matcher.group(1))) {
                    myIsInModule = true;
                } else {
                    myStreamingDirectoryContentListener.messageSent(message);
                    myIsInModule = false;
                }
            } else if (DirectoryContentListener.moduleMessage_ver1(message)) {
                myIsInModule = true;
            }
            if (myIsInModule) {
                myStreamingDirectoryContentListener.messageSent(message);
            }
            final DirectoryContent streamingDirectoryContent = myStreamingDirectoryContentListener.getDirectoryContent();
            if (myStreamingListener != null) {
                final long timePassed = System.currentTimeMillis() - timeStamp;
                if (streamingDirectoryContent.getTotalSize() > 0 && timePassed > 25L) {
                    myStreamingListener.consume(streamingDirectoryContent);
                    final DirectoryContentListener newListener = new DirectoryContentListener();
                    newListener.setModuleName(myStreamingDirectoryContentListener.getModuleName());
                    myStreamingDirectoryContentListener = newListener;
                    timeStamp = System.currentTimeMillis();
                }
            } else {
                myDirectoryContentListener.getDirectoryContent().copyDataFrom(streamingDirectoryContent);
            }
        }

        @Override
        public void modifyOptions(GlobalOptions options) {
            super.modifyOptions(options);
            options.setDoNoChanges(true);
        }
    };
    operation.addFinishAction(() -> myStreamingListener.consume(myStreamingDirectoryContentListener.getDirectoryContent()));
    return operation;
}
Also used : GlobalOptions(org.netbeans.lib.cvsclient.command.GlobalOptions) AdminReaderOnStoredRepositoryPath(com.intellij.cvsSupport2.cvsoperations.javacvsSpecificImpls.AdminReaderOnStoredRepositoryPath) CheckoutCommand(org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand) Matcher(java.util.regex.Matcher) CvsRootProvider(com.intellij.cvsSupport2.connections.CvsRootProvider)

Example 7 with CvsRootProvider

use of com.intellij.cvsSupport2.connections.CvsRootProvider in project intellij-community by JetBrains.

the class CvsCommandOperation method createEnvironment.

private IClientEnvironment createEnvironment(IConnection connection, final CvsRootProvider root, UpdatedFilesManager mergedFilesCollector, CvsExecutionEnvironment cvsExecutionEnv) {
    final File localRoot = getLocalRootFor(root);
    final File adminRoot = getAdminRootFor(root);
    LOG.assertTrue(localRoot != null, getClass().getName());
    LOG.assertTrue(adminRoot != null, getClass().getName());
    return new ClientEnvironment(connection, localRoot, adminRoot, root.getCvsRoot(), createLocalFileReader(), createLocalFileWriter(root.getCvsRootAsString(), mergedFilesCollector, cvsExecutionEnv), myAdminReader, myAdminWriter, getIgnoreFileFilter(), new FileReadOnlyHandler(), CvsApplicationLevelConfiguration.getCharset());
}
Also used : FileReadOnlyHandler(com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler) ClientEnvironment(org.netbeans.lib.cvsclient.ClientEnvironment) IClientEnvironment(org.netbeans.lib.cvsclient.IClientEnvironment) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 8 with CvsRootProvider

use of com.intellij.cvsSupport2.connections.CvsRootProvider in project intellij-community by JetBrains.

the class EditOperation method execute.

@Override
protected void execute(CvsRootProvider root, CvsExecutionEnvironment executionEnvironment, ReadWriteStatistics statistics, IProgressViewer progressViewer) throws CommandException, CommandAbortedException, VcsException {
    super.execute(root, executionEnvironment, statistics, progressViewer);
    final VcsException vcsException = new CvsException(FILES_BEING_EDITED_EXCEPTION, root.getCvsRootAsString());
    for (EditedFileInfo info : myEditFileInfos) {
        if (info.isSuitableFor(root))
            return;
        final File file = info.getFile(root);
        final VirtualFile virtualFile = CvsVfsUtil.findFileByIoFile(file);
        if (virtualFile != null)
            vcsException.setVirtualFile(virtualFile);
    }
    if (!myEditFileInfos.isEmpty())
        throw vcsException;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) VcsException(com.intellij.openapi.vcs.VcsException) CvsException(com.intellij.cvsSupport2.errorHandling.CvsException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 9 with CvsRootProvider

use of com.intellij.cvsSupport2.connections.CvsRootProvider in project intellij-community by JetBrains.

the class LoadHistoryOperation method createCommand.

protected Command createCommand(CvsRootProvider root, CvsExecutionEnvironment cvsExecutionEnvironment) {
    final RlogCommand command = new RlogCommand();
    command.setModuleName(myModule);
    command.setHeadersOnly(false);
    command.setNoTags(myNoTags);
    if (myDateFrom != null) {
        command.setDateFrom(DATE_FORMAT.format(myDateFrom));
    }
    if (myDateTo != null) {
        command.setDateTo(DATE_FORMAT.format(myDateTo));
    }
    command.setRevisions(myRevisions);
    if (ourDoNotSupportingSOptionServers.contains(root.getCvsRootAsString())) {
        command.setSuppressEmptyHeaders(false);
    }
    return command;
}
Also used : RlogCommand(com.intellij.cvsSupport2.cvsoperations.cvsLog.RlogCommand)

Aggregations

CvsRootProvider (com.intellij.cvsSupport2.connections.CvsRootProvider)3 CvsException (com.intellij.cvsSupport2.errorHandling.CvsException)3 VcsException (com.intellij.openapi.vcs.VcsException)3 AuthenticationException (org.netbeans.lib.cvsclient.connection.AuthenticationException)3 RlogCommand (com.intellij.cvsSupport2.cvsoperations.cvsLog.RlogCommand)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 File (java.io.File)2 IClientEnvironment (org.netbeans.lib.cvsclient.IClientEnvironment)2 CheckoutCommand (org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand)2 CvsResultEx (com.intellij.cvsSupport2.CvsResultEx)1 CvsEntriesManager (com.intellij.cvsSupport2.application.CvsEntriesManager)1 IgnoreFileFilterBasedOnCvsEntriesManager (com.intellij.cvsSupport2.cvsIgnore.IgnoreFileFilterBasedOnCvsEntriesManager)1 CvsExecutionEnvironment (com.intellij.cvsSupport2.cvsoperations.common.CvsExecutionEnvironment)1 GetModulesListOperation (com.intellij.cvsSupport2.cvsoperations.cvsContent.GetModulesListOperation)1 ErrorMessagesProcessor (com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorMessagesProcessor)1 CvsMessagesListener (com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesListener)1 CvsMessagesTranslator (com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesTranslator)1 AdminReaderOnStoredRepositoryPath (com.intellij.cvsSupport2.cvsoperations.javacvsSpecificImpls.AdminReaderOnStoredRepositoryPath)1 CannotFindCvsRootException (com.intellij.cvsSupport2.errorHandling.CannotFindCvsRootException)1 FileReadOnlyHandler (com.intellij.cvsSupport2.javacvsImpl.FileReadOnlyHandler)1