Commit ca42667c authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

status: keep second-ambiguous mtimes during fixup

Now that we support the feature, we can keep "second ambiguous" mtime during the fixup phase.
These are the mtime that would be ambiguous if we did not had sub-second précions.

See the v2 format documentation for details.

Differential Revision: https://phab.mercurial-scm.org/D11847
parent be2317167a9b
Pipeline #29853 failed with stages
in 41 minutes and 25 seconds
......@@ -102,4 +102,5 @@
"""
file_mtime = mtime_of(stat_result)
file_second = file_mtime[0]
file_ns = file_mtime[1]
boundary_second = present_mtime[0]
......@@ -105,6 +106,7 @@
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.
#
......@@ -106,8 +108,8 @@
# 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.
......@@ -112,6 +114,11 @@
# 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment