Mercurial > hg-stable
changeset 19652:187bf2dde7c1
pack_dirstate: only invalidate mtime for files written in the last second
Previously we'd place files written in the last second in the lookup set. This
can lead to pathological cases where a file always remains in the lookup set if
it gets modified before the next time status is run.
With this patch, only the mtime of those files is invalidated. This means that
if a file's size or mode changes, we can immediately declare it as modified
without needing to compare file contents.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sat, 17 Aug 2013 20:48:49 -0700 |
parents | 902c646019ad |
children | ad09fc68ef6f |
files | mercurial/parsers.c mercurial/pure/parsers.py |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/parsers.c Sat Aug 31 10:20:15 2013 -0700 +++ b/mercurial/parsers.c Sat Aug 17 20:48:49 2013 -0700 @@ -330,7 +330,7 @@ * this. */ if (PyDict_SetItem(map, k, dirstate_unset) == -1) goto bail; - mode = 0, size = -1, mtime = -1; + mtime = -1; } putbe32(mode, p); putbe32(size, p + 4);
--- a/mercurial/pure/parsers.py Sat Aug 31 10:20:15 2013 -0700 +++ b/mercurial/pure/parsers.py Sat Aug 17 20:48:49 2013 -0700 @@ -100,11 +100,11 @@ # systems with a granularity of 1 sec). This commonly happens # for at least a couple of files on 'update'. # The user could change the file without changing its size - # within the same second. Invalidate the file's stat data in + # within the same second. Invalidate the file's mtime in # dirstate, forcing future 'status' calls to compare the - # contents of the file. This prevents mistakenly treating such - # files as clean. - e = (e[0], 0, -1, -1) # mark entry as 'unset' + # contents of the file if the size is the same. This prevents + # mistakenly treating such files as clean. + e = (e[0], e[1], e[2], -1) dmap[f] = e if f in copymap: