Search in sources :

Example 36 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class HgBrowseChangesTest method doTest.

private void doTest() throws HgCommandException, VcsException {
    CachingCommittedChangesProvider provider = myVcs.getCachingCommittedChangesProvider();
    assert provider != null;
    //noinspection unchecked
    List<CommittedChangeList> revisions = provider.getCommittedChanges(mySettings, new HgRepositoryLocation(myRepository.getUrl(), myRepository), -1);
    assertTrue(!revisions.isEmpty());
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) CachingCommittedChangesProvider(com.intellij.openapi.vcs.CachingCommittedChangesProvider) HgRepositoryLocation(org.zmlx.hg4idea.provider.HgRepositoryLocation)

Example 37 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class SvnCachingRevisionsTest method createCommittedIterator.

private Iterator<ChangesBunch> createCommittedIterator(final int bunchSize, final List<Long> revisions) {
    final List<ChangesBunch> list = new ArrayList<>();
    for (int i = revisions.size() - 1; i >= 0; i -= bunchSize) {
        final int j = (bunchSize > i) ? -1 : (i - bunchSize);
        final List<CommittedChangeList> subList = new ArrayList<>();
        for (int k = i; k > j; --k) {
            subList.add(createList(revisions.get(k)));
        }
        list.add(new ChangesBunch(subList, (j != -1)));
        if (j == -1) {
            break;
        }
    }
    return list.iterator();
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) ChangesBunch(com.intellij.openapi.vcs.changes.committed.ChangesBunch)

Example 38 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class AbstractVcsHelperImpl method showChangesBrowser.

public void showChangesBrowser(final CommittedChangesProvider provider, final RepositoryLocation location, @Nls String title, Component parent) {
    final ChangesBrowserSettingsEditor filterUI = provider.createFilterUI(true);
    ChangeBrowserSettings settings = provider.createDefaultSettings();
    boolean ok;
    if (filterUI != null) {
        final CommittedChangesFilterDialog dlg = new CommittedChangesFilterDialog(myProject, filterUI, settings);
        dlg.show();
        ok = dlg.getExitCode() == DialogWrapper.OK_EXIT_CODE;
        settings = dlg.getSettings();
    } else {
        ok = true;
    }
    if (ok) {
        if (myProject.isDefault() || (ProjectLevelVcsManager.getInstance(myProject).getAllActiveVcss().length == 0) || (!ModalityState.NON_MODAL.equals(ModalityState.current()))) {
            final List<CommittedChangeList> versions = new ArrayList<>();
            if (parent == null || !parent.isValid()) {
                parent = WindowManager.getInstance().suggestParentWindow(myProject);
            }
            final CommittedChangesTableModel model = new CommittedChangesTableModel(versions, true);
            final AsynchronousListsLoader[] task = new AsynchronousListsLoader[1];
            final ChangeBrowserSettings finalSettings = settings;
            final ChangesBrowserDialog dlg = createChangesBrowserDialog(model, title, filterUI != null, parent, new Consumer<ChangesBrowserDialog>() {

                @Override
                public void consume(ChangesBrowserDialog changesBrowserDialog) {
                    task[0] = new AsynchronousListsLoader(myProject, provider, location, finalSettings, changesBrowserDialog);
                    ProgressManager.getInstance().run(task[0]);
                }
            });
            dlg.startLoading();
            dlg.show();
            if (task[0] != null) {
                task[0].cancel();
                final List<VcsException> exceptions = task[0].getExceptions();
                if (!exceptions.isEmpty()) {
                    Messages.showErrorDialog(myProject, VcsBundle.message("browse.changes.error.message", exceptions.get(0).getMessage()), VcsBundle.message("browse.changes.error.title"));
                    return;
                }
                if (!task[0].isRevisionsReturned()) {
                    Messages.showInfoMessage(myProject, VcsBundle.message("browse.changes.nothing.found"), VcsBundle.message("browse.changes.nothing.found.title"));
                }
            }
        } else {
            openCommittedChangesTab(provider, location, settings, 0, title);
        }
    }
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) ChangesBrowserSettingsEditor(com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)

Example 39 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class SvnCommittedChangesProvider method loadCommittedChanges.

@Override
public void loadCommittedChanges(@NotNull ChangeBrowserSettings settings, @NotNull RepositoryLocation location, int maxCount, @NotNull AsynchConsumer<CommittedChangeList> consumer) throws VcsException {
    try {
        SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
        String repositoryRoot = getRepositoryRoot(svnLocation);
        ChangeBrowserSettings.Filter filter = settings.createFilter();
        Consumer<LogEntry> resultConsumer = logEntry -> {
            SvnChangeList list = new SvnChangeList(myVcs, svnLocation, logEntry, repositoryRoot);
            if (filter.accepts(list)) {
                consumer.consume(list);
            }
        };
        SvnTarget target = SvnTarget.fromURL(svnLocation.toSvnUrl(), createBeforeRevision(settings));
        getCommittedChangesImpl(settings, target, maxCount, resultConsumer, false, true);
    } finally {
        consumer.finished();
    }
}
Also used : AsynchConsumer(com.intellij.util.AsynchConsumer) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) VcsRevisionNumber(com.intellij.openapi.vcs.history.VcsRevisionNumber) VirtualFile(com.intellij.openapi.vfs.VirtualFile) Date(java.util.Date) ProgressManager.progress(com.intellij.openapi.progress.ProgressManager.progress) VcsCommittedViewAuxiliary(com.intellij.openapi.vcs.changes.committed.VcsCommittedViewAuxiliary) VcsCommittedListsZipper(com.intellij.openapi.vcs.changes.committed.VcsCommittedListsZipper) PairConsumer(com.intellij.util.PairConsumer) SvnBundle.message(org.jetbrains.idea.svn.SvnBundle.message) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) ApplicationManager.getApplication(com.intellij.openapi.application.ApplicationManager.getApplication) Collections.singletonList(java.util.Collections.singletonList) ConfigureBranchesAction(org.jetbrains.idea.svn.branchConfig.ConfigureBranchesAction) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) MessageBusConnection(com.intellij.util.messages.MessageBusConnection) SvnUtil(org.jetbrains.idea.svn.SvnUtil) ProgressManager.progress2(com.intellij.openapi.progress.ProgressManager.progress2) SvnVcs(org.jetbrains.idea.svn.SvnVcs) FileUtil(com.intellij.openapi.util.io.FileUtil) Logger(com.intellij.openapi.diagnostic.Logger) com.intellij.openapi.vcs(com.intellij.openapi.vcs) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) VcsUtil(com.intellij.vcsUtil.VcsUtil) DataOutput(java.io.DataOutput) DecoratorManager(com.intellij.openapi.vcs.changes.committed.DecoratorManager) SVNException(org.tmatesoft.svn.core.SVNException) Collection(java.util.Collection) Set(java.util.Set) VcsConfigurationChangeListener(com.intellij.openapi.vcs.changes.committed.VcsConfigurationChangeListener) IOException(java.io.IOException) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) File(java.io.File) ContainerUtil.newArrayList(com.intellij.util.containers.ContainerUtil.newArrayList) Nullable(org.jetbrains.annotations.Nullable) StatusType(org.jetbrains.idea.svn.status.StatusType) Depth(org.jetbrains.idea.svn.api.Depth) List(java.util.List) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) SVNURL(org.tmatesoft.svn.core.SVNURL) ContainerUtil.newHashSet(com.intellij.util.containers.ContainerUtil.newHashSet) Pair(com.intellij.openapi.util.Pair) DataInput(java.io.DataInput) ChangesBrowserSettingsEditor(com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor) Registry(com.intellij.openapi.util.registry.Registry) NotNull(org.jetbrains.annotations.NotNull) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) Consumer(com.intellij.util.Consumer) ChangeBrowserSettings(com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget)

Example 40 with CommittedChangeList

use of com.intellij.openapi.vcs.versionBrowser.CommittedChangeList in project intellij-community by JetBrains.

the class CachedProvider method getEarliestBunchInInterval.

@Nullable
public Fragment getEarliestBunchInInterval(final long earliestRevision, final long oldestRevision, final int desirableSize, final boolean includeYoungest, final boolean includeOldest) throws VcsException {
    if ((earliestRevision > getEarliestRevision()) || (earliestRevision == -1)) {
        if (myAlreadyReaded == null) {
            return null;
        }
        // just return first
        return createFromLoaded(myAlreadyReaded, earliestRevision, oldestRevision, desirableSize, includeYoungest, includeOldest, false);
    }
    final ChangesBunch loadedBunch = myAlreadyReaded;
    final List<CommittedChangeList> list = loadedBunch.getList();
    if (list.isEmpty()) {
        return null;
    }
    final long oldest = list.get(list.size() - 1).getNumber();
    if ((!includeYoungest) && (oldest == earliestRevision)) {
        return packNext(earliestRevision, oldestRevision, desirableSize, includeOldest, loadedBunch.isConsistentWithPrevious());
    //} else if ((oldest <= earliestRevision) && (youngest >= earliestRevision)) {
    } else if (oldest <= earliestRevision) {
        return createFromLoaded(loadedBunch, earliestRevision, oldestRevision, desirableSize, includeYoungest, includeOldest, false);
    }
    return null;
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) ChangesBunch(com.intellij.openapi.vcs.changes.committed.ChangesBunch) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

CommittedChangeList (com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)45 ChangeBrowserSettings (com.intellij.openapi.vcs.versionBrowser.ChangeBrowserSettings)8 Nullable (org.jetbrains.annotations.Nullable)8 Change (com.intellij.openapi.vcs.changes.Change)7 ChangesBunch (com.intellij.openapi.vcs.changes.committed.ChangesBunch)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)4 NotNull (org.jetbrains.annotations.NotNull)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 Project (com.intellij.openapi.project.Project)3 Pair (com.intellij.openapi.util.Pair)3 List (java.util.List)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 Application (com.intellij.openapi.application.Application)2 Task (com.intellij.openapi.progress.Task)2 Ref (com.intellij.openapi.util.Ref)2 VcsFileRevision (com.intellij.openapi.vcs.history.VcsFileRevision)2 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)2 ChangesBrowserSettingsEditor (com.intellij.openapi.vcs.versionBrowser.ChangesBrowserSettingsEditor)2 IOException (java.io.IOException)2