[texworks] external read-access causes TeXWorks to revert open file to old version

Stefan Müller warrence.stm at gmx.de
Mon Nov 1 23:01:13 CET 2010

On 01.11.2010 19:05, Stefan Löffler wrote:
> Yes, this seems to confirm my theory.
> First of all, you should get the "Changed" line only if the file is
> actually being reloaded. Which it shouldn't be, if the file wasn't
> changed externally - that's the whole point ;).
> Now, the fact that Tw prints a later time-stamp during a positive run
> than a subsequent invocation of `ls` suggests that the file is indeed
> written twice. First the file is changed during the commit, which Tw
> picks up. Then, the original file (with the earlier timestamp) is
> restored, but Tw doesn't pick that up (probably because it is still
> processing the first change). As such, this naturally only happens
> occasionally (if mercurial takes a certain time to process the commit).
> Unfortunately, I don't see a quick fix for this. One thing would be to
> never reload a file unasked. This would be a bit of an inconvenience for
> "normal" users, though. Another possibility would be to process the
> updates in a separate thread, thereby keeping track of all changes. Or
> to check the file state again after the loading (and rerun the reload
> method in case the file has changed again in the meantime). This last
> option strikes me as the safest one.

It seems somewhat strange to me, that TW reloads the file unasked if 
something changed on disk. E.g. it may be the case that I replaced the 
file by accident or something. I know at least some applications that 
ask me when this happens. Strangely, TW once asked me that, too. I think 
it was a (strange) "positive" run.

> Have you been in touch with the mercurial people? Did they say anything
> about the two stages of the commit?

I did not contact them because I thought I first talk to you guys and 
see what you come up with. I'll check tomorrow if I can find a 
TortoiseHG mailing list or something and show them this thread.

Indeed, I don't understand why the file changes anyway during a commit. 
I always thought it is read-only. This should have to do something with 
TortoiseHG. I assume that TW doesn't see ghosts or something.

> Stefan

Thanks so far, :)
Stefan M.

More information about the texworks mailing list