Mercurial > hg
diff mercurial/dirstate.py @ 52059:b332ae615714
merge: improve working-copy mtime race handling
Explanations inline. This also makes use of `make_mtime_reliable`, which
unifies our mtime raciness logic from the status.
On top of this, this fixes the handling of the pure dirstate status to better
catch racy status, as we've been doing in Rust for a long time now.
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Wed, 16 Oct 2024 19:14:30 +0200 |
parents | 93d872a06132 |
children |
line wrap: on
line diff
--- a/mercurial/dirstate.py Wed Oct 16 18:56:19 2024 +0200 +++ b/mercurial/dirstate.py Wed Oct 16 19:14:30 2024 +0200 @@ -1769,14 +1769,28 @@ ladd(fn) else: madd(fn) - elif not t.mtime_likely_equal_to(timestamp.mtime_of(st)): - # There might be a change in the future if for example the - # internal clock is off, but this is a case where the issues - # the user would face would be a lot worse and there is - # nothing we can really do. - ladd(fn) - elif listclean: - cadd(fn) + else: + reliable = None + if mtime_boundary is not None: + reliable = timestamp.reliable_mtime_of( + st, mtime_boundary + ) + elif t.mtime_likely_equal_to(timestamp.mtime_of(st)): + # We can't compute the current fs time, so we're in + # a readonly fs or a LFS context. + cadd(fn) + continue + + if reliable is None or not t.mtime_likely_equal_to( + reliable + ): + # There might be a change in the future if for example + # the internal clock is off, but this is a case where + # the issues the user would face would be a lot worse + # and there is nothing we can really do. + ladd(fn) + elif listclean: + cadd(fn) status = scmutil.status( modified, added, removed, deleted, unknown, ignored, clean )