From c66ea3901971665318239e86b9c1ae9859083a83 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Thu, 6 Mar 2014 16:47:44 +0100 Subject: [PATCH] Local History fix: load file children on fileCreated event (second try) --- .../src/com/intellij/history/integration/IdeaGateway.java | 7 +++++++ .../history/integration/LocalHistoryEventDispatcher.java | 2 +- .../intellij/history/integration/FileListeningTest.java | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java b/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java index 24a7603e45f7..911b84231ae8 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java +++ b/platform/lvcs-impl/src/com/intellij/history/integration/IdeaGateway.java @@ -146,6 +146,13 @@ public class IdeaGateway { return nf.getCachedChildren(); } + @NotNull + public static Collection loadAndIterateChildren(VirtualFile f) { + if (!(f instanceof NewVirtualFile)) return Collections.emptyList(); + NewVirtualFile nf = (NewVirtualFile)f; + return Arrays.asList(nf.getChildren()); + } + @NotNull public RootEntry createTransientRootEntry() { ApplicationManager.getApplication().assertReadAccessAllowed(); diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.java b/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.java index cb20957f3ed7..5f9aad057c90 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.java +++ b/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.java @@ -93,7 +93,7 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V myVcs.created(f.getPath(), f.isDirectory()); } if (f.isDirectory()) { - for (VirtualFile each : IdeaGateway.iterateDBChildren(f)) { + for (VirtualFile each : IdeaGateway.loadAndIterateChildren(f)) { createRecursively(each); } } diff --git a/platform/platform-tests/testSrc/com/intellij/history/integration/FileListeningTest.java b/platform/platform-tests/testSrc/com/intellij/history/integration/FileListeningTest.java index d192ef3b5016..865865699645 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/integration/FileListeningTest.java +++ b/platform/platform-tests/testSrc/com/intellij/history/integration/FileListeningTest.java @@ -73,7 +73,6 @@ public class FileListeningTest extends IntegrationTestCase { myRoot.refresh(false, true); List changes = getVcs().getChangeListInTests().getChangesInTests().get(0).getChanges(); - assertEquals(changes.toString(), 4, changes.size()); List actual = new SmartList(); for (Change each : changes) { actual.add(((StructuralChange)each).getPath());