Page 1 of 1

File changed detection

Posted: Wed Nov 14, 2012 1:52 pm
by Rosch
Hi...

From time to time it could happen that files which are opened in an editor tab of codelite changes externally. I yet cannot find anything in codelite that (eg. on window focus change) checks this and reloads the files/brings up a panel saying that the local file is outdated. Is this not yet implemented or a bug?

Thanks,

Roland

Re: File changed detection

Posted: Wed Nov 14, 2012 2:18 pm
by Jarod42
It works for me... (tried with an external astyle (which kept the date) and external notepad++).
A popup appears which shows which files are changed and proposes to reload them (you can select which files to reload).

So, if it doesn't work for you, I would say it is a bug.

Re: File changed detection

Posted: Wed Nov 14, 2012 2:25 pm
by eranif
Rosch wrote:Is this not yet implemented or a bug?
It is implemented and is working for quite few years now...

Can you please provide some more information on your OS, codelite version etc?

Eran

Re: File changed detection

Posted: Wed Nov 14, 2012 2:45 pm
by Rosch
Hi Eranif
eranif wrote:
Rosch wrote:Is this not yet implemented or a bug?
It is implemented and is working for quite few years now...

Can you please provide some more information on your OS, codelite version etc?

Eran
I am running on windows 7 64bit with current (rev 5945) svn sources of codelite.

Maybe I traced the problem down. Codelite only reconizes the file changed when the new mtime/ctime/birthtime (or whatever) is newer than the the last save/load time. It is not working when the time jumps back eg. on an external svn revert which also sets back the times.

This way you can easily reproduce the problem:
1. Load a file which is under svn control in codelite
2. change it in codelite and save it
3. svn revert it externally (I used cygwin svn commandline for it - this also did set back the filetimes)
4. switch back to codelite
5. No file changed detection.

Is codelite maybe checking the mtime of the file against the last mtime it had on loading the file and maybe is not updating its internal records when a file gets saved?

Roland

Re: File changed detection

Posted: Fri Nov 16, 2012 5:34 pm
by Rosch
Rosch wrote:Is codelite maybe checking the mtime of the file against the last mtime it had on loading the file and maybe is not updating its internal records when a file gets saved?
After this bugged me some times to often over the recent days I looked into it. The problem was that codelite checks for diskmtime being greated than last editor mtime. This is not the case when the filemtime winds back by eg. a svn revert.

The attached patch fixes it. Now it is checked that diskmtime is different from last editor mtime.

I hope this is ok...

Roland

Re: File changed detection

Posted: Fri Nov 16, 2012 9:26 pm
by eranif
Committed to trunk

Eran