only remember the unchanged content of which we are sure it's unchanged: the file...
authorpeter <peter@jetbrains.com>
Wed, 25 Jan 2012 18:39:36 +0000 (19:39 +0100)
committerpeter <peter@jetbrains.com>
Wed, 25 Jan 2012 18:41:22 +0000 (19:41 +0100)
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
platform/vcs-impl/src/com/intellij/openapi/vcs/changes/LastUnchangedContentTracker.java

index fc56d4c1803e8eacd988fc9286162ff8a03454a8..18c615edc131df7f2aae4d2a907d953ad6c19656 100644 (file)
@@ -449,6 +449,17 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
         }
       });
 
+      for (VcsDirtyScope scope : scopes) {
+        scope.iterateExistingInsideScope(new Processor<VirtualFile>() {
+          @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) {
index a351d94130efbb01ae9c2caceb655c328fe208dc..7897453bc415397559f41c307eb99af38085eb88 100644 (file)
@@ -37,8 +37,13 @@ public class LastUnchangedContentTracker {
   private static final Key<Long> 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<Boolean> 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