Search in sources :

Example 6 with CvsResult

use of com.intellij.openapi.cvsIntegration.CvsResult in project intellij-community by JetBrains.

the class TagsHelper method getBranchesProvider.

private static BranchesProvider getBranchesProvider(CvsOperation operation, Project project) throws VcsException {
    LOG.assertTrue(operation instanceof BranchesProvider);
    final CvsOperationExecutor executor = new CvsOperationExecutor(true, project, new ModalityContextImpl(ModalityState.defaultModalityState()));
    final CommandCvsHandler handler = new CommandCvsHandler(CvsBundle.message("load.tags.operation.name"), operation, true);
    executor.performActionSync(handler, CvsOperationExecutorCallback.EMPTY);
    final CvsResult executionResult = executor.getResult();
    if (executionResult.hasErrors())
        throw executionResult.composeError();
    return (BranchesProvider) operation;
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) ModalityContextImpl(com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult)

Example 7 with CvsResult

use of com.intellij.openapi.cvsIntegration.CvsResult in project intellij-community by JetBrains.

the class ComparableVcsRevisionOnOperation method loadContent.

public byte[] loadContent() throws IOException, VcsException {
    if (!myOperation.isLoaded()) {
        CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
        executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file"), myOperation), CvsOperationExecutorCallback.EMPTY);
        CvsResult result = executor.getResult();
        if (result.isCanceled()) {
            throw new ProcessCanceledException();
        }
        if (result.hasErrors()) {
            throw result.composeError();
        }
    }
    return getContent();
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Example 8 with CvsResult

use of com.intellij.openapi.cvsIntegration.CvsResult in project intellij-community by JetBrains.

the class CvsUpdateEnvironment method updateDirectories.

@NotNull
public UpdateSession updateDirectories(@NotNull FilePath[] contentRoots, final UpdatedFiles updatedFiles, ProgressIndicator progressIndicator, @NotNull final Ref<SequentialUpdatesContext> contextRef) {
    CvsConfiguration cvsConfiguration = CvsConfiguration.getInstance(myProject);
    if (!myLastUpdateWasConfigured) {
        cvsConfiguration.CLEAN_COPY = false;
        cvsConfiguration.RESET_STICKY = false;
    }
    myLastUpdateWasConfigured = false;
    try {
        final UpdateSettingsOnCvsConfiguration updateSettings = createSettingsAndUpdateContext(cvsConfiguration, contextRef);
        final UpdateHandler handler = CommandCvsHandler.createUpdateHandler(contentRoots, updateSettings, myProject, updatedFiles);
        handler.addCvsListener(new UpdatedFilesProcessor(updatedFiles));
        CvsOperationExecutor cvsOperationExecutor = new CvsOperationExecutor(true, myProject, ModalityState.defaultModalityState());
        cvsOperationExecutor.setShowErrors(false);
        cvsOperationExecutor.performActionSync(handler, CvsOperationExecutorCallback.EMPTY);
        final CvsResult result = cvsOperationExecutor.getResult();
        return createUpdateSessionAdapter(updatedFiles, result);
    } finally {
        cvsConfiguration.CLEAN_COPY = false;
        cvsConfiguration.RESET_STICKY = false;
    }
}
Also used : UpdateHandler(com.intellij.cvsSupport2.cvshandlers.UpdateHandler) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration) CvsConfiguration(com.intellij.cvsSupport2.config.CvsConfiguration) UpdatedFilesProcessor(com.intellij.cvsSupport2.updateinfo.UpdatedFilesProcessor) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) UpdateSettingsOnCvsConfiguration(com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with CvsResult

use of com.intellij.openapi.cvsIntegration.CvsResult in project intellij-community by JetBrains.

the class CvsAnnotationProvider method executeOperation.

private AnnotateOperation executeOperation(File file, String revision, CvsEnvironment root, boolean binary, boolean retryOnFailure) throws VcsException {
    final AnnotateOperation operation = new AnnotateOperation(file, revision, root, binary);
    final CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
    executor.performActionSync(new CommandCvsHandler(CvsBundle.getAnnotateOperationName(), operation), CvsOperationExecutorCallback.EMPTY);
    final CvsResult result = executor.getResult();
    if (result.hasErrors()) {
        if (!retryOnFailure) {
            throw result.composeError();
        }
        for (VcsException error : result.getErrors()) {
            for (String message : error.getMessages()) {
                if (message.contains(INVALID_OPTION_F) || message.contains(USAGE_CVSNTSRV_SERVER)) {
                    ourDoNotAnnotateBinaryRoots.add(root.getCvsRootAsString());
                    return executeOperation(file, revision, root, false, false);
                }
            }
        }
        throw result.composeError();
    }
    return operation;
}
Also used : CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) VcsException(com.intellij.openapi.vcs.VcsException) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler) AnnotateOperation(com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.AnnotateOperation) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult)

Example 10 with CvsResult

use of com.intellij.openapi.cvsIntegration.CvsResult in project intellij-community by JetBrains.

the class CvsCommittedChangesProvider method loadCommittedChanges.

private List<CvsChangeList> loadCommittedChanges(final ChangeBrowserSettings settings, final String module, CvsEnvironment connectionSettings, final VirtualFile rootFile) throws VcsException {
    if (connectionSettings.isOffline()) {
        return Collections.emptyList();
    }
    final CvsChangeListsBuilder builder = new CvsChangeListsBuilder(module, connectionSettings, myProject, rootFile);
    final Date dateTo = settings.getDateBeforeFilter();
    Date dateFrom = settings.getDateAfterFilter();
    if (dateFrom == null) {
        final Calendar calendar = Calendar.getInstance();
        calendar.set(1970, Calendar.MARCH, 2);
        dateFrom = calendar.getTime();
    }
    final LoadHistoryOperation operation = new LoadHistoryOperation(connectionSettings, module, dateFrom, dateTo, logInformationWrapper -> builder.add(logInformationWrapper));
    final CvsResult executionResult = operation.run(myProject);
    if (executionResult.isCanceled()) {
        throw new ProcessCanceledException();
    } else if (executionResult.hasErrors()) {
        throw executionResult.composeError();
    } else {
        final List<CvsChangeList> versions = builder.getVersions();
        settings.filterChanges(versions);
        return versions;
    }
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) CvsResult(com.intellij.openapi.cvsIntegration.CvsResult) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Aggregations

CvsResult (com.intellij.openapi.cvsIntegration.CvsResult)11 CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)7 ProcessCanceledException (com.intellij.openapi.progress.ProcessCanceledException)6 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)5 VcsException (com.intellij.openapi.vcs.VcsException)3 CvsEnvironment (com.intellij.cvsSupport2.connections.CvsEnvironment)2 UpdateHandler (com.intellij.cvsSupport2.cvshandlers.UpdateHandler)2 UpdatedFilesProcessor (com.intellij.cvsSupport2.updateinfo.UpdatedFilesProcessor)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 CvsResultEx (com.intellij.cvsSupport2.CvsResultEx)1 UpdateSettings (com.intellij.cvsSupport2.actions.update.UpdateSettings)1 UpdateSettingsOnCvsConfiguration (com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)1 CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)1 ModalityContextImpl (com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl)1 CvsExecutionEnvironment (com.intellij.cvsSupport2.cvsoperations.common.CvsExecutionEnvironment)1 AnnotateOperation (com.intellij.cvsSupport2.cvsoperations.cvsAnnotate.AnnotateOperation)1 GetFileContentOperation (com.intellij.cvsSupport2.cvsoperations.cvsContent.GetFileContentOperation)1 GetModulesListOperation (com.intellij.cvsSupport2.cvsoperations.cvsContent.GetModulesListOperation)1 ErrorMessagesProcessor (com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorMessagesProcessor)1