# HG changeset patch # User Pierre-Yves David # Date 1637687613 -3600 # Node ID c0d88407b7d44a9367b8830f2fa1bc374f9681e1 # Parent 9ae0353c9f5daa3e40650f3eb6e159aef6d0475d largefile: use the proper "mtime boundary" logic during fixup This will prevent ambiguous cache entry to be used in racy situation. This fix flakiness in test and some real live misbehavior. Differential Revision: https://phab.mercurial-scm.org/D11800 diff -r 9ae0353c9f5d -r c0d88407b7d4 hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py Tue Nov 23 18:03:51 2021 +0100 +++ b/hgext/largefiles/lfutil.py Tue Nov 23 18:13:33 2021 +0100 @@ -261,13 +261,10 @@ st = wctx[lfile].lstat() mode = st.st_mode size = st.st_size - mtime = timestamp.mtime_of(st) - 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) + mtime = timestamp.reliable_mtime_of(st, mtime_boundary) + if mtime is not None: + cache_data = (mode, size, mtime) + lfdirstate.set_clean(lfile, cache_data) return s diff -r 9ae0353c9f5d -r c0d88407b7d4 hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py Tue Nov 23 18:03:51 2021 +0100 +++ b/hgext/largefiles/reposetup.py Tue Nov 23 18:13:33 2021 +0100 @@ -228,13 +228,12 @@ s = wctx[lfile].lstat() mode = s.st_mode 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) + mtime = timestamp.reliable_mtime_of( + s, mtime_boundary + ) + if mtime is not None: + cache_data = (mode, size, mtime) + lfdirstate.set_clean(lfile, cache_data) else: tocheck = unsure + modified + added + clean modified, added, clean = [], [], []