Search in sources :

Example 1 with LocalPathIndifferentLogOperation

use of com.intellij.cvsSupport2.cvsoperations.cvsLog.LocalPathIndifferentLogOperation in project intellij-community by JetBrains.

the class CvsHistoryProvider method createRevisions.

private List<VcsFileRevision> createRevisions(final CvsEnvironment connectionSettings, final File lightweightFileForFile) {
    final LocalPathIndifferentLogOperation logOperation = new LocalPathIndifferentLogOperation(connectionSettings);
    logOperation.addFile(lightweightFileForFile);
    final CvsOperationExecutor executor = new CvsOperationExecutor(myProject);
    final ArrayList<VcsFileRevision> result = new ArrayList<>();
    executor.performActionSync(new CommandCvsHandler(CvsBundle.message("operation.name.load.file.content"), logOperation), new DefaultCvsOperationExecutorCallback() {

        @Override
        public void executionFinishedSuccessfully() {
            final LogInformation firstLogInformation = logOperation.getFirstLogInformation();
            if (firstLogInformation != null) {
                final List<Revision> revisionList = firstLogInformation.getRevisionList();
                for (Revision revision : revisionList) {
                    result.add(new CvsFileRevisionImpl(revision, lightweightFileForFile, firstLogInformation, connectionSettings, myProject));
                }
            }
        }
    });
    Collections.sort(result, Collections.reverseOrder(VcsFileRevisionComparator.INSTANCE));
    return result;
}
Also used : LocalPathIndifferentLogOperation(com.intellij.cvsSupport2.cvsoperations.cvsLog.LocalPathIndifferentLogOperation) Revision(org.netbeans.lib.cvsclient.command.log.Revision) CvsOperationExecutor(com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor) LogInformation(org.netbeans.lib.cvsclient.command.log.LogInformation) DefaultCvsOperationExecutorCallback(com.intellij.cvsSupport2.cvsExecution.DefaultCvsOperationExecutorCallback) CvsChangeList(com.intellij.cvsSupport2.changeBrowser.CvsChangeList) List(java.util.List) CommandCvsHandler(com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)

Example 2 with LocalPathIndifferentLogOperation

use of com.intellij.cvsSupport2.cvsoperations.cvsLog.LocalPathIndifferentLogOperation in project intellij-community by JetBrains.

the class StickyHeadGetter method getBranchHeadRevision.

@Nullable
protected String getBranchHeadRevision(final VirtualFile parent, final String name, final Convertor<CvsRevisionNumber, Boolean> chooser) {
    final LocalPathIndifferentLogOperation operation = new LocalPathIndifferentLogOperation(new File(parent.getPath(), name));
    final Ref<Boolean> logSuccess = new Ref<>(Boolean.TRUE);
    final CvsExecutionEnvironment cvsExecutionEnvironment = new CvsExecutionEnvironment(new CvsMessagesAdapter(), CvsExecutionEnvironment.DUMMY_STOPPER, new ErrorProcessor() {

        public void addError(VcsException ex) {
            logSuccess.set(Boolean.FALSE);
        }

        public List<VcsException> getErrors() {
            return null;
        }
    }, PostCvsActivity.DEAF, myProject);
    try {
        // should already be logged in
        //operation.login(context);
        operation.execute(cvsExecutionEnvironment, false);
    } catch (VcsException | CommandAbortedException e) {
    //
    }
    if (Boolean.TRUE.equals(logSuccess.get())) {
        return extractRevision(operation, chooser);
    }
    return null;
}
Also used : ErrorProcessor(com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorProcessor) Ref(com.intellij.openapi.util.Ref) LocalPathIndifferentLogOperation(com.intellij.cvsSupport2.cvsoperations.cvsLog.LocalPathIndifferentLogOperation) CvsExecutionEnvironment(com.intellij.cvsSupport2.cvsoperations.common.CvsExecutionEnvironment) CommandAbortedException(org.netbeans.lib.cvsclient.command.CommandAbortedException) VcsException(com.intellij.openapi.vcs.VcsException) CvsMessagesAdapter(com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesAdapter) List(java.util.List) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

LocalPathIndifferentLogOperation (com.intellij.cvsSupport2.cvsoperations.cvsLog.LocalPathIndifferentLogOperation)2 List (java.util.List)2 CvsChangeList (com.intellij.cvsSupport2.changeBrowser.CvsChangeList)1 CvsOperationExecutor (com.intellij.cvsSupport2.cvsExecution.CvsOperationExecutor)1 DefaultCvsOperationExecutorCallback (com.intellij.cvsSupport2.cvsExecution.DefaultCvsOperationExecutorCallback)1 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)1 CvsExecutionEnvironment (com.intellij.cvsSupport2.cvsoperations.common.CvsExecutionEnvironment)1 ErrorProcessor (com.intellij.cvsSupport2.cvsoperations.cvsErrors.ErrorProcessor)1 CvsMessagesAdapter (com.intellij.cvsSupport2.cvsoperations.cvsMessages.CvsMessagesAdapter)1 Ref (com.intellij.openapi.util.Ref)1 VcsException (com.intellij.openapi.vcs.VcsException)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 File (java.io.File)1 Nullable (org.jetbrains.annotations.Nullable)1 CommandAbortedException (org.netbeans.lib.cvsclient.command.CommandAbortedException)1 LogInformation (org.netbeans.lib.cvsclient.command.log.LogInformation)1 Revision (org.netbeans.lib.cvsclient.command.log.Revision)1