Search in sources :

Example 1 with CommittedChangeList

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

the class ConfigureBranchesAction method update.

public void update(final AnActionEvent e) {
    final Project project = e.getProject();
    final Presentation presentation = e.getPresentation();
    if (project == null) {
        presentation.setEnabled(false);
        presentation.setVisible(false);
        return;
    }
    presentation.setText(SvnBundle.message("configure.branches.item"));
    presentation.setDescription(SvnBundle.message("configure.branches.item"));
    presentation.setIcon(SvnIcons.ConfigureBranches);
    presentation.setVisible(true);
    final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
    presentation.setEnabled((cls != null) && (cls.length > 0) && (SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) && (((SvnChangeList) cls[0]).getRoot() != null));
}
Also used : Project(com.intellij.openapi.project.Project) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 2 with CommittedChangeList

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

the class ConfigureBranchesAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    final Project project = e.getProject();
    final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
    if ((cls == null) || (cls.length == 0) || (!SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) || (((SvnChangeList) cls[0]).getRoot() == null)) {
        return;
    }
    final SvnChangeList svnList = (SvnChangeList) cls[0];
    BranchConfigurationDialog.configureBranches(project, svnList.getRoot());
}
Also used : Project(com.intellij.openapi.project.Project) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) SvnChangeList(org.jetbrains.idea.svn.history.SvnChangeList) ChangeList(com.intellij.openapi.vcs.changes.ChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)

Example 3 with CommittedChangeList

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

the class RootsAndBranches method getPanelData.

private SvnMergeInfoRootPanelManual getPanelData(final List<CommittedChangeList> listsList) {
    for (CommittedChangeList list : listsList) {
        if (!(list instanceof SvnChangeList)) {
            return null;
        }
        final SvnChangeList svnList = (SvnChangeList) list;
        final String wcPath = svnList.getWcPath();
        if (wcPath == null) {
            continue;
        }
        return getPanelData(wcPath);
    }
    return null;
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList)

Example 4 with CommittedChangeList

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

the class LiveProvider method getEarliestBunchInIntervalImpl.

private Fragment getEarliestBunchInIntervalImpl(long earliestRevision, final long oldestRevision, final int desirableSize, final boolean includeYoungest, final boolean includeOldest, final long earliestToTake) throws VcsException {
    if ((myEarliestRevisionWasAccessed) || ((oldestRevision == myYoungestRevision) && ((!includeYoungest) || (!includeOldest)))) {
        return null;
    }
    final SVNRevision youngRevision = (earliestRevision == -1) ? SVNRevision.HEAD : SVNRevision.create(earliestRevision);
    final Ref<List<CommittedChangeList>> refToList = new Ref<>();
    final Ref<VcsException> exceptionRef = new Ref<>();
    final Runnable loader = () -> {
        try {
            refToList.set(myLoader.loadInterval(youngRevision, SVNRevision.create(oldestRevision), desirableSize, includeYoungest, includeOldest));
        } catch (VcsException e) {
            exceptionRef.set(e);
        }
    };
    final Application application = ApplicationManager.getApplication();
    if (application.isUnitTestMode() || !application.isDispatchThread()) {
        loader.run();
    } else {
        ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
            final ProgressIndicator ind = ProgressManager.getInstance().getProgressIndicator();
            if (ind != null) {
                ind.setText(SvnBundle.message("progress.live.provider.loading.revisions.details.text"));
            }
            loader.run();
        }, SvnBundle.message("progress.live.provider.loading.revisions.text"), false, myVcs.getProject());
    }
    if (!exceptionRef.isNull()) {
        final VcsException e = exceptionRef.get();
        if (isElementNotFound(e)) {
            // occurs when target URL is deleted in repository
            // try to find latest existent revision. expensive ...
            final LatestExistentSearcher searcher = new LatestExistentSearcher(oldestRevision, myYoungestRevision, (oldestRevision != 0), myVcs, myLocation.toSvnUrl(), myRepositoryUrl);
            final long existent = searcher.getLatestExistent();
            if ((existent == -1) || (existent == earliestRevision)) {
                myEarliestRevisionWasAccessed = true;
                return null;
            }
            return getEarliestBunchInIntervalImpl(existent, oldestRevision, includeYoungest ? desirableSize : (desirableSize + 1), true, includeOldest, Math.min(existent, earliestRevision));
        }
        throw e;
    }
    final List<CommittedChangeList> list = refToList.get();
    if (list.isEmpty()) {
        myEarliestRevisionWasAccessed = (oldestRevision == 0);
        return null;
    }
    if (earliestToTake > 0) {
        for (Iterator<CommittedChangeList> iterator = list.iterator(); iterator.hasNext(); ) {
            final CommittedChangeList changeList = iterator.next();
            if (changeList.getNumber() > earliestToTake)
                iterator.remove();
        }
    }
    myEarliestRevisionWasAccessed = (oldestRevision == 0) && ((list.size() + ((!includeOldest) ? 1 : 0) + ((!includeYoungest) ? 1 : 0)) < desirableSize);
    return new Fragment(Origin.LIVE, list, true, true, null);
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) Ref(com.intellij.openapi.util.Ref) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) VcsException(com.intellij.openapi.vcs.VcsException) List(java.util.List) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) Application(com.intellij.openapi.application.Application)

Example 5 with CommittedChangeList

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

the class LoadedRevisionsCache method put.

@Nullable
public Bunch put(final List<CommittedChangeList> data, final boolean consistentWithPrevious, final Bunch bindTo) {
    if (data.isEmpty()) {
        return null;
    }
    final SvnRepositoryLocation repositoryLocation = ((SvnChangeList) data.get(0)).getLocation();
    final String location = repositoryLocation.getURL();
    final List<List<CommittedChangeList>> list = split(data, SvnRevisionsNavigationMediator.CHUNK_SIZE);
    Bunch bindToBunch = bindTo;
    if (bindToBunch == null) {
        final Bunch fromCache = myMap.get(location);
        if (fromCache != null) {
            final long passedSmallestNumber = data.get(data.size() - 1).getNumber();
            final List<CommittedChangeList> cachedList = fromCache.getList();
            final long greatestNumber = cachedList.get(0).getNumber();
            if (greatestNumber < passedSmallestNumber) {
                bindToBunch = fromCache;
            }
        }
    }
    boolean consistent = consistentWithPrevious;
    for (int i = list.size() - 1; i >= 0; --i) {
        final List<CommittedChangeList> changeLists = list.get(i);
        debugInfo(changeLists, consistent, bindToBunch);
        bindToBunch = new Bunch(changeLists, consistent, bindToBunch);
        consistent = true;
    }
    myMap.put(location, bindToBunch);
    return bindToBunch;
}
Also used : CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) ChangesBunch(com.intellij.openapi.vcs.changes.committed.ChangesBunch) CommittedChangeList(com.intellij.openapi.vcs.versionBrowser.CommittedChangeList) 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