comparison mercurial/pure/parsers.py @ 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 194e63c1ccb9
children e250b8300e6e
comparison
equal deleted inserted replaced
19651:902c646019ad 19652:187bf2dde7c1
98 # The file was last modified "simultaneously" with the current 98 # The file was last modified "simultaneously" with the current
99 # write to dirstate (i.e. within the same second for file- 99 # write to dirstate (i.e. within the same second for file-
100 # systems with a granularity of 1 sec). This commonly happens 100 # systems with a granularity of 1 sec). This commonly happens
101 # for at least a couple of files on 'update'. 101 # for at least a couple of files on 'update'.
102 # The user could change the file without changing its size 102 # The user could change the file without changing its size
103 # within the same second. Invalidate the file's stat data in 103 # within the same second. Invalidate the file's mtime in
104 # dirstate, forcing future 'status' calls to compare the 104 # dirstate, forcing future 'status' calls to compare the
105 # contents of the file. This prevents mistakenly treating such 105 # contents of the file if the size is the same. This prevents
106 # files as clean. 106 # mistakenly treating such files as clean.
107 e = (e[0], 0, -1, -1) # mark entry as 'unset' 107 e = (e[0], e[1], e[2], -1)
108 dmap[f] = e 108 dmap[f] = e
109 109
110 if f in copymap: 110 if f in copymap:
111 f = "%s\0%s" % (f, copymap[f]) 111 f = "%s\0%s" % (f, copymap[f])
112 e = _pack(">cllll", e[0], e[1], e[2], e[3], len(f)) 112 e = _pack(">cllll", e[0], e[1], e[2], e[3], len(f))