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);
}
Aggregations