Search in sources :

Example 1 with CheckoutCommand

use of org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand in project intellij-community by JetBrains.

the class GetFileContentOperation method createCommand.

protected Command createCommand(CvsRootProvider root, CvsExecutionEnvironment cvsExecutionEnvironment) {
    myState = LOADING;
    myRoot.changeAdminRootTo(new File("."));
    myRoot.changeLocalRootTo(new File("."));
    CheckoutCommand command = new CheckoutCommand(null);
    command.setRecursive(false);
    command.addModule(myModuleName);
    command.setPrintToOutput(true);
    myRevisionOrDate.setForCommand(command);
    return command;
}
Also used : CheckoutCommand(org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 2 with CheckoutCommand

use of org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand in project intellij-community by JetBrains.

the class GetModuleContentOperation method createExpandingRepositoryPathOperation.

private LocalPathIndifferentOperation createExpandingRepositoryPathOperation(AdminWriterStoringRepositoryPath adminWriter, CvsEnvironment environment, final String moduleName) {
    return new LocalPathIndifferentOperation(adminWriter, environment) {

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

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

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

        @Override
        public void moduleExpanded(String module) {
            super.moduleExpanded(module);
            if (myModuleLocation == null) {
                myModuleLocation = module;
                myStreamingDirectoryContentListener.setModuleName(myModuleLocation);
            }
        }
    };
}
Also used : CheckoutCommand(org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand) CvsRootProvider(com.intellij.cvsSupport2.connections.CvsRootProvider)

Example 3 with CheckoutCommand

use of org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand 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 4 with CheckoutCommand

use of org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand in project intellij-community by JetBrains.

the class CheckoutFileOperation method createCommand.

protected Command createCommand(CvsRootProvider root, CvsExecutionEnvironment cvsExecutionEnvironment) {
    final CheckoutCommand result = new CheckoutCommand(null);
    result.setRecursive(true);
    result.addModule(myModuleName);
    myRevisionOrDate.setForCommand(result);
    if (!isRoot()) {
        result.setAlternativeCheckoutDirectory(myIsDirectory ? myFile.getName() : ".");
    }
    return result;
}
Also used : CheckoutCommand(org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand)

Example 5 with CheckoutCommand

use of org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand in project intellij-community by JetBrains.

the class CheckoutProjectOperation method createCommand.

protected Command createCommand(CvsRootProvider root, CvsExecutionEnvironment cvsExecutionEnvironment) {
    final CheckoutCommand command = new CheckoutCommand(() -> ((CheckoutAdminWriter) myAdminWriter).finish());
    command.setRecursive(true);
    for (String myModuleName : myModuleNames) {
        command.addModule(myModuleName);
    }
    root.getRevisionOrDate().setForCommand(command);
    command.setAlternativeCheckoutDirectory(myAlternateCheckoutDirectory);
    command.setPruneDirectories(myPruneEmptyDirectories);
    command.setKeywordSubstitution(myKeywordSubstitution);
    return command;
}
Also used : CheckoutCommand(org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand)

Aggregations

CheckoutCommand (org.netbeans.lib.cvsclient.command.checkout.CheckoutCommand)5 CvsRootProvider (com.intellij.cvsSupport2.connections.CvsRootProvider)2 AdminReaderOnStoredRepositoryPath (com.intellij.cvsSupport2.cvsoperations.javacvsSpecificImpls.AdminReaderOnStoredRepositoryPath)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 Matcher (java.util.regex.Matcher)1 GlobalOptions (org.netbeans.lib.cvsclient.command.GlobalOptions)1