diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index fc56d4c1803e..18c615edc131 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -449,6 +449,17 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec } }); + for (VcsDirtyScope scope : scopes) { + scope.iterateExistingInsideScope(new Processor() { + @Override + public boolean process(VirtualFile file) { + file.putUserData(LastUnchangedContentTracker.VCS_INVALID_FILE_STATUS, null); //todo what if it has become dirty again during update? + return true; + } + }); + } + + myChangesViewManager.scheduleRefresh(); } catch (DisposedException e) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LastUnchangedContentTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LastUnchangedContentTracker.java index a351d94130ef..7897453bc415 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LastUnchangedContentTracker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LastUnchangedContentTracker.java @@ -37,8 +37,13 @@ public class LastUnchangedContentTracker { private static final Key LAST_TS_KEY = Key.create("LAST_TS_KEY"); private static final FileAttribute LAST_TS_ATTR = new FileAttribute("LAST_TS_ATTR", 0, true); private static final FileAttribute ACQUIRED_CONTENT_ATTR = new FileAttribute("ACQUIRED_CONTENT_ATTR", 1, true); + public static final Key VCS_INVALID_FILE_STATUS = Key.create("VCS_INVALID_FILE_STATUS"); public static void updateLastUnchangedContent(@NotNull VirtualFile file) { + if (Boolean.TRUE.equals(file.getUserData(VCS_INVALID_FILE_STATUS))) { + return; + } + Long lastTs = getLastSavedStamp(file); final long stamp = file.getModificationStamp(); if (lastTs != null && stamp == lastTs) { @@ -51,6 +56,7 @@ public class LastUnchangedContentTracker { } saveContentReference(file, getFS().acquireContent(file)); + file.putUserData(VCS_INVALID_FILE_STATUS, Boolean.TRUE); } @Nullable