Search in sources :

Example 11 with CvsResult

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

the class CvsCommittedChangesProvider method loadCommittedChanges.

public void loadCommittedChanges(ChangeBrowserSettings settings, RepositoryLocation location, int maxCount, final AsynchConsumer<CommittedChangeList> consumer) throws VcsException {
    try {
        final CvsRepositoryLocation cvsLocation = (CvsRepositoryLocation) location;
        final String module = cvsLocation.getModuleName();
        final CvsEnvironment connectionSettings = cvsLocation.getEnvironment();
        if (connectionSettings.isOffline()) {
            return;
        }
        final CvsChangeListsBuilder builder = new CvsChangeListsBuilder(module, connectionSettings, myProject, cvsLocation.getRootFile());
        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 ChangeBrowserSettings.Filter filter = settings.createFilter();
        final Set<CvsChangeList> controlSet = new HashSet<>();
        final LoadHistoryOperation operation = new LoadHistoryOperation(connectionSettings, module, dateFrom, dateTo, wrapper -> {
            final List<RevisionWrapper> wrappers = builder.revisionWrappersFromLog(wrapper);
            if (wrappers != null) {
                for (RevisionWrapper revisionWrapper : wrappers) {
                    final CvsChangeList changeList = builder.addRevision(revisionWrapper);
                    if (controlSet.contains(changeList))
                        continue;
                    controlSet.add(changeList);
                    if (filter.accepts(changeList)) {
                        consumer.consume(changeList);
                    }
                }
            }
        });
        final CvsResult executionResult = operation.run(myProject);
        if (executionResult.isCanceled()) {
            throw new ProcessCanceledException();
        } else if (executionResult.hasErrors()) {
            throw executionResult.composeError();
        }
    } finally {
        consumer.finished();
    }
}
Also used : CvsResult(com.intellij.openapi.cvsIntegration.CvsResult) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) CvsEnvironment(com.intellij.cvsSupport2.connections.CvsEnvironment) 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