[Updated] D11847: status: keep second-ambiguous mtimes during fixup

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Fri Dec 3 10:44:23 UTC 2021


Closed by commit rHGca42667c8d26: status: keep second-ambiguous mtimes during fixup (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11847?vs=31276&id=31292

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11847/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11847

AFFECTED FILES
  mercurial/dirstateutils/timestamp.py

CHANGE DETAILS

diff --git a/mercurial/dirstateutils/timestamp.py b/mercurial/dirstateutils/timestamp.py
--- a/mercurial/dirstateutils/timestamp.py
+++ b/mercurial/dirstateutils/timestamp.py
@@ -102,16 +102,23 @@
     """
     file_mtime = mtime_of(stat_result)
     file_second = file_mtime[0]
+    file_ns = file_mtime[1]
     boundary_second = present_mtime[0]
+    boundary_ns = present_mtime[1]
     # If the mtime of the ambiguous file is younger (or equal) to the starting
     # point of the `status` walk, we cannot garantee that another, racy, write
     # will not happen right after with the same mtime and we cannot cache the
     # information.
     #
-    # However is the mtime is far away in the future, this is likely some
+    # However if the mtime is far away in the future, this is likely some
     # mismatch between the current clock and previous file system operation. So
     # mtime more than one days in the future are considered fine.
-    if boundary_second <= file_second < (3600 * 24 + boundary_second):
+    if boundary_second == file_second:
+        if file_ns and boundary_ns:
+            if file_ns < boundary_ns:
+                return timestamp((file_second, file_ns, True))
+        return None
+    elif boundary_second < file_second < (3600 * 24 + boundary_second):
         return None
     else:
         return file_mtime



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211203/c156702f/attachment-0002.html>


More information about the Mercurial-patches mailing list