diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java index b42349b58d44..2cf5287e9ce8 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangesCacheFile.java @@ -127,7 +127,7 @@ public class ChangesCacheFile { closeStreams(); } catch (IOException e) { - // + LOG.debug(e); } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesCache.java index 4beaf8aade02..ae09c0101029 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesCache.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesCache.java @@ -453,7 +453,9 @@ public class CommittedChangesCache implements PersistentStateComponent files = myCachesHolder.getAllCaches(); + debug(files.size() + " caches found"); for(ChangesCacheFile file: files) { if (file.isEmpty()) { initCache(file); @@ -462,6 +464,7 @@ public class CommittedChangesCache implements PersistentStateComponent initCache(final ChangesCacheFile cacheFile) throws VcsException, IOException { @@ -503,6 +506,7 @@ public class CommittedChangesCache implements PersistentStateComponent refreshCache(final ChangesCacheFile cacheFile) throws VcsException, IOException { + debug("Refreshing cache for " + cacheFile.getLocation()); final List newLists = new ArrayList<>(); final CachingCommittedChangesProvider provider = cacheFile.getProvider(); @@ -590,6 +594,8 @@ public class CommittedChangesCache implements PersistentStateComponent result = new ArrayList<>(); final Collection caches = myCachesHolder.getAllCaches(); + debug(caches.size() + " caches found"); + final MultiMap>> byVcs = new MultiMap<>(); @@ -601,6 +607,9 @@ public class CommittedChangesCache implements PersistentStateComponent 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); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java index c2fde4aaa55b..5bb81d7f3293 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/RootsCalculator.java @@ -54,18 +54,23 @@ public class RootsCalculator { @NotNull public Map getRoots() { + LOG.debug("Collecting roots for " + myVcs); // TODO: It is not quite clear why using just ProjectLevelVcsManager.getRootsUnderVcs() is not sufficient List roots = getRootsFromMappings(); addAll(roots, myPlManager.getRootsUnderVcs(myVcs)); + logRoots("Candidates", roots); + roots.removeIf(file -> getLocation(file) == null); + logRoots("Candidates with repository location", roots); + Map result = StreamEx.of(myVcs.filterUniqueRoots(roots, identity())) .distinct() .mapToEntry(this::getLocation) .nonNullValues() .toMap(); - logRoots(result.keySet()); + logRoots("Unique roots", result.keySet()); return result; } @@ -98,9 +103,9 @@ public class RootsCalculator { return myLocationCache.getLocation(myVcs, getFilePath(file), false); } - private static void logRoots(@NotNull Collection roots) { + private static void logRoots(@NotNull String prefix, @NotNull Collection roots) { if (LOG.isDebugEnabled()) { - LOG.debug("Roots for committed changes load: " + join(roots, VirtualFile::getPath, ", ")); + LOG.debug(prefix + ": " + join(roots, VirtualFile::getPath, ", ")); } } } diff --git a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/changes/committed/CommittedChangesCacheTest.java b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/changes/committed/CommittedChangesCacheTest.java index bbe1e0e8010d..da870fd3b31a 100644 --- a/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/changes/committed/CommittedChangesCacheTest.java +++ b/platform/vcs-tests/testSrc/com/intellij/openapi/vcs/changes/committed/CommittedChangesCacheTest.java @@ -74,6 +74,7 @@ public class CommittedChangesCacheTest extends PlatformTestCase { myVcsManager.setDirectoryMappings(singletonList(new VcsDirectoryMapping("", myVcs.getName()))); myCache = CommittedChangesCache.getInstance(getProject()); + assertEquals(1, myCache.getCachesHolder().getAllCaches().size()); myTempDir = createTempDirectory(); myContentRoot = getVirtualFile(myTempDir);