Search in sources :

Example 1 with RepositoryLocationGroup

use of com.intellij.openapi.vcs.changes.committed.RepositoryLocationGroup in project intellij-community by JetBrains.

the class SvnCommittedListsZipper method groupLocations.

public Pair<List<RepositoryLocationGroup>, List<RepositoryLocation>> groupLocations(final List<RepositoryLocation> in) {
    final List<RepositoryLocationGroup> groups = new ArrayList<>();
    final List<RepositoryLocation> singles = new ArrayList<>();
    final MultiMap<SVNURL, RepositoryLocation> map = new MultiMap<>();
    for (RepositoryLocation location : in) {
        final SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
        final String url = svnLocation.getURL();
        final SVNURL root = SvnUtil.getRepositoryRoot(myVcs, url);
        if (root == null) {
            // should not occur
            LOG.info("repository root not found for location:" + location.toPresentableString());
            singles.add(location);
        } else {
            map.putValue(root, svnLocation);
        }
    }
    final Set<SVNURL> keys = map.keySet();
    for (SVNURL key : keys) {
        final Collection<RepositoryLocation> repositoryLocations = map.get(key);
        if (repositoryLocations.size() == 1) {
            singles.add(repositoryLocations.iterator().next());
        } else {
            final SvnRepositoryLocationGroup group = new SvnRepositoryLocationGroup(key, repositoryLocations);
            groups.add(group);
        }
    }
    return Pair.create(groups, singles);
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) ArrayList(java.util.ArrayList) RepositoryLocation(com.intellij.openapi.vcs.RepositoryLocation) MultiMap(com.intellij.util.containers.MultiMap) RepositoryLocationGroup(com.intellij.openapi.vcs.changes.committed.RepositoryLocationGroup)

Aggregations

RepositoryLocation (com.intellij.openapi.vcs.RepositoryLocation)1 RepositoryLocationGroup (com.intellij.openapi.vcs.changes.committed.RepositoryLocationGroup)1 MultiMap (com.intellij.util.containers.MultiMap)1 ArrayList (java.util.ArrayList)1 SVNURL (org.tmatesoft.svn.core.SVNURL)1