List<CommittedChangeList> (boolean inBackground) { final List<CommittedChangeList> result = new ArrayList<>(); final Collection<ChangesCacheFile> caches = myCachesHolder.getAllCaches(); debug(caches.size() + " caches found"); final MultiMap<AbstractVcs, Pair<RepositoryLocation, List<CommittedChangeList>>> byVcs = new MultiMap<>(); for(ChangesCacheFile cache: caches) { try { if (inBackground && (! cache.getVcs().isVcsBackgroundOperationsAllowed(cache.getRootPath().getVirtualFile()))) continue; if (!cache.isEmpty()) { debug("Loading incoming changes for " + cache.getLocation()); final List<CommittedChangeList> incomingChanges = cache.loadIncomingChanges(); byVcs.putValue(cache.getVcs(), Pair.create(cache.getLocation(), incomingChanges)); } else { debug("Empty cache found for " + cache.getLocation()); } } catch (IOException e) { LOG.error(e); } } for (AbstractVcs vcs : byVcs.keySet()) { final CommittedChangesProvider committedChangesProvider = vcs.getCommittedChangesProvider(); VcsCommittedListsZipper vcsZipper = committedChangesProvider.getZipper(); if (vcsZipper != null) { final VcsCommittedListsZipper incomingZipper = new IncomingListsZipper(vcsZipper); final CommittedListsSequencesZipper zipper = new CommittedListsSequencesZipper(incomingZipper); for (Pair<RepositoryLocation, List<CommittedChangeList>> pair : byVcs.get(vcs)) { zipper.add(pair.getFirst(), pair.getSecond()); } result.addAll(zipper.execute()); } else { for (Pair<RepositoryLocation, List<CommittedChangeList>> pair : byVcs.get(vcs)) { result.addAll(pair.getSecond()); } } } myCachedIncomingChangeLists = result; debug("Incoming changes loaded"); fireIncomingChangesUpdated(result); return result; }