Search in sources :

Example 11 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler in project intellij-community by JetBrains.

the class CommandCvsHandler method createCommitHandler.

public static CvsHandler createCommitHandler(FilePath[] selectedFiles, String commitMessage, String title, boolean makeNewFilesReadOnly, Project project, final boolean tagFilesAfterCommit, final String tagName, @NotNull final List<File> dirsToPrune) {
    final CommitFilesOperation operation = new CommitFilesOperation(commitMessage, makeNewFilesReadOnly);
    if (selectedFiles != null) {
        for (FilePath selectedFile : selectedFiles) {
            operation.addFile(selectedFile.getIOFile());
        }
    }
    if (!dirsToPrune.isEmpty()) {
        operation.addFinishAction(() -> {
            final IOFilesBasedDirectoryPruner pruner = new IOFilesBasedDirectoryPruner(null);
            for (File dir : dirsToPrune) {
                pruner.addFile(dir);
            }
            pruner.execute();
        });
    }
    final CommandCvsHandler result = new CommandCvsHandler(title, operation, FileSetToBeUpdated.selectedFiles(selectedFiles));
    if (tagFilesAfterCommit) {
        result.addOperation(new TagOperation(selectedFiles, tagName, false, CvsConfiguration.getInstance(project).OVERRIDE_EXISTING_TAG_FOR_PROJECT));
    }
    return result;
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) CommitFilesOperation(com.intellij.cvsSupport2.cvsoperations.cvsCommit.CommitFilesOperation) TagOperation(com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.TagOperation) VirtualFile(com.intellij.openapi.vfs.VirtualFile) CvsLightweightFile(com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile) File(java.io.File)

Example 12 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler in project intellij-community by JetBrains.

the class CommandCvsHandler method createUneditHandler.

public static CvsHandler createUneditHandler(VirtualFile[] selectedFiles, boolean makeNewFilesReadOnly) {
    final UneditOperation operation = new UneditOperation(makeNewFilesReadOnly);
    operation.addFiles(selectedFiles);
    return new CommandCvsHandler(CvsBundle.message("operation.name.unedit"), operation, FileSetToBeUpdated.selectedFiles(selectedFiles));
}
Also used : UneditOperation(com.intellij.cvsSupport2.cvsoperations.cvsEdit.UneditOperation)

Example 13 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler in project intellij-community by JetBrains.

the class CvsServicesImpl method checkout.

public CvsResult checkout(String[] modules, File checkoutTo, String directory, boolean makeNewFilesReadOnly, boolean pruneEmptyDirectories, Object keywordSubstitution, Project project, CvsRepository repository) {
    LOG.assertTrue(modules.length > 0);
    CheckoutProjectOperation operation = new CheckoutProjectOperation(modules, CvsRootConfiguration.createOn(repository), makeNewFilesReadOnly, checkoutTo, directory, pruneEmptyDirectories, (KeywordSubstitution) keywordSubstitution);
    final CvsOperationExecutor executor = new CvsOperationExecutor(project);
    executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.checkout"), operation, true), CvsOperationExecutorCallback.EMPTY);
    return executor.getResult();
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CheckoutProjectOperation(com.intellij.cvsSupport2.cvsoperations.cvsCheckOut.CheckoutProjectOperation) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)

Example 14 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler in project intellij-community by JetBrains.

the class CommandCvsHandler method createAddFilesHandler.

public static CvsHandler createAddFilesHandler(final Project project, Collection<AddedFileInfo> addedRoots) {
    final AddFilesOperation operation = new AddFilesOperation();
    final ArrayList<AddedFileInfo> addedFileInfo = new ArrayList<>();
    for (final AddedFileInfo info : addedRoots) {
        info.clearAllCvsAdminDirectoriesInIncludedDirectories();
        addedFileInfo.addAll(info.collectAllIncludedFiles());
    }
    final ArrayList<VirtualFile> addedFiles = new ArrayList<>();
    for (AddedFileInfo info : addedFileInfo) {
        addedFiles.add(info.getFile());
        operation.addFile(info.getFile(), info.getKeywordSubstitution());
    }
    return new CommandCvsHandler(CvsBundle.message("action.name.add"), operation, FileSetToBeUpdated.selectedFiles(VfsUtilCore.toVirtualFileArray(addedFiles)), VcsConfiguration.getInstance(project).getAddRemoveOption());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) AddedFileInfo(com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddedFileInfo) AddFilesOperation(com.intellij.cvsSupport2.cvsoperations.cvsAdd.AddFilesOperation)

Example 15 with CommandCvsHandler

use of com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler in project intellij-community by JetBrains.

the class CommandCvsHandler method createTagHandler.

public static CvsHandler createTagHandler(FilePath[] selectedFiles, String tagName, boolean switchToThisTag, boolean overrideExisting, boolean makeNewFilesReadOnly, Project project) {
    final CompositeOperation operation = new CompositeOperation();
    operation.addOperation(new TagOperation(selectedFiles, tagName, false, overrideExisting));
    if (switchToThisTag) {
        operation.addOperation(new UpdateOperation(selectedFiles, tagName, makeNewFilesReadOnly, project));
    }
    return new CommandCvsHandler(CvsBundle.message("operation.name.create.tag"), operation, FileSetToBeUpdated.selectedFiles(selectedFiles));
}
Also used : TagOperation(com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.TagOperation) UpdateOperation(com.intellij.cvsSupport2.cvsoperations.cvsUpdate.UpdateOperation)

Aggregations

CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)12 CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 CvsResult (com.intellij.openapi.cvsIntegration.CvsResult)5 File (java.io.File)4 CvsLightweightFile (com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile)3 VcsException (com.intellij.openapi.vcs.VcsException)3 CheckoutProjectOperation (com.intellij.cvsSupport2.cvsoperations.cvsCheckOut.CheckoutProjectOperation)2 GetFileContentOperation (com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation)2 TagOperation (com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.TagOperation)2 UpdateOperation (com.intellij.cvsSupport2.cvsoperations.cvsUpdate.UpdateOperation)2 WatchOperation (com.intellij.cvsSupport2.cvsoperations.cvsWatch.WatchOperation)2 SimpleRevision (com.intellij.cvsSupport2.cvsoperations.dateOrRevision.SimpleRevision)2 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)2 IOException (java.io.IOException)2 CvsEntriesManager (com.intellij.cvsSupport2.application.CvsEntriesManager)1 CvsChangeList (com.intellij.cvsSupport2.changeBrowser.CvsChangeList)1 CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)1 DefaultCvsOperationExecutorCallback (com.intellij.cvsSupport2.cvsExecution.DefaultCvsOperationExecutorCallback)1 ModalityContextImpl (com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl)1