diff 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
line wrap: on
line diff
--- a/hgext/largefiles/reposetup.py	Thu Nov 18 15:00:13 2021 +0100
+++ b/hgext/largefiles/reposetup.py	Thu Nov 18 13:12:40 2021 +0100
@@ -197,7 +197,7 @@
                     match._files = [f for f in match._files if sfindirstate(f)]
                     # Don't waste time getting the ignored and unknown
                     # files from lfdirstate
-                    unsure, s = lfdirstate.status(
+                    unsure, s, mtime_boundary = lfdirstate.status(
                         match,
                         subrepos=[],
                         ignored=False,
@@ -230,6 +230,10 @@
                                 size = s.st_size
                                 mtime = timestamp.mtime_of(s)
                                 cache_data = (mode, size, mtime)
+                                # We should consider using the mtime_boundary
+                                # logic here, but largefile never actually had
+                                # ambiguity protection before, so this confuse
+                                # the tests and need more thinking.
                                 lfdirstate.set_clean(lfile, cache_data)
                     else:
                         tocheck = unsure + modified + added + clean