markExternalChangesAsUpToDate not being consistently called (4.0 release)

I'm working on a plugin for a vcs system that has a revert capability, perforce. In other words you run a command and perforce will change the file on the disk for you. My problem is that IDEA is not consistently recognizing the changes. The file on the disk is changed but the editor is not showing the change.

I could understand that it would not work, or that it would work, but not that it sometimes does and sometimes doesn't. I've attached two traces that show a successful and an unsuccessful revert. The difference is that in the successful case (line 13) in the trace markExternalChangesAsUpToDate is called on my AbstractVcs implementation (which returns true (ignore the false in the log)). Then on line 16 a contentsChanged event is fired. In the unsuccessful run (same code, 12 seconds earlier) line 13 matches line 17 in the successful run. I believe that whatever happens in these lines is responsible for one revert succeeding and another failing.

Does anyone have any suggestions for how to get this to work consistently?



Please sign in to leave a comment.