Mercurial > hg
comparison hgext/largefiles/reposetup.py @ 48390:322525db4c98
status: use filesystem time boundary to invalidate racy mtime
We record the filesystem time at the start of the status walk and use that as a
boundary to detect files that might be modified during (or right after) the
status run without the mtime allowing that edition to be detected. We
currently do this at a second precision. In a later patch, we will use
nanosecond precision when available.
To cope with "broken" time on the file system where file could be in the
future, we also keep mtime for file over one day in the future. See inline
comment for details.
Large file tests get a bit more confused as we reduce the odds for race
condition.
As a "side effect", the win32text extension is happy again.
Differential Revision: https://phab.mercurial-scm.org/D11794
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 18 Nov 2021 13:12:40 +0100 |
parents | 991e6f728b50 |
children | c0d88407b7d4 |
comparison
equal
deleted
inserted
replaced
48389:03644a929d6e | 48390:322525db4c98 |
---|---|
195 return sf in dirstate or dirstate.hasdir(sf) | 195 return sf in dirstate or dirstate.hasdir(sf) |
196 | 196 |
197 match._files = [f for f in match._files if sfindirstate(f)] | 197 match._files = [f for f in match._files if sfindirstate(f)] |
198 # Don't waste time getting the ignored and unknown | 198 # Don't waste time getting the ignored and unknown |
199 # files from lfdirstate | 199 # files from lfdirstate |
200 unsure, s = lfdirstate.status( | 200 unsure, s, mtime_boundary = lfdirstate.status( |
201 match, | 201 match, |
202 subrepos=[], | 202 subrepos=[], |
203 ignored=False, | 203 ignored=False, |
204 clean=listclean, | 204 clean=listclean, |
205 unknown=False, | 205 unknown=False, |
228 s = wctx[lfile].lstat() | 228 s = wctx[lfile].lstat() |
229 mode = s.st_mode | 229 mode = s.st_mode |
230 size = s.st_size | 230 size = s.st_size |
231 mtime = timestamp.mtime_of(s) | 231 mtime = timestamp.mtime_of(s) |
232 cache_data = (mode, size, mtime) | 232 cache_data = (mode, size, mtime) |
233 # We should consider using the mtime_boundary | |
234 # logic here, but largefile never actually had | |
235 # ambiguity protection before, so this confuse | |
236 # the tests and need more thinking. | |
233 lfdirstate.set_clean(lfile, cache_data) | 237 lfdirstate.set_clean(lfile, cache_data) |
234 else: | 238 else: |
235 tocheck = unsure + modified + added + clean | 239 tocheck = unsure + modified + added + clean |
236 modified, added, clean = [], [], [] | 240 modified, added, clean = [], [], [] |
237 checkexec = self.dirstate._checkexec | 241 checkexec = self.dirstate._checkexec |