only remember the unchanged content of which we are sure it's unchanged: the file is not queued for vcs update

This commit is contained in:
peter
2012-01-25 19:41:22 +01:00
parent 5c8bb8f28d
commit bbfb1d46fd
2 changed files with 17 additions and 0 deletions
@@ -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) {
@@ -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