dirstate: Document Timestamp.second_ambiguous
authorSimon Sapin <simon.sapin@octobus.net>
Thu, 09 Dec 2021 10:23:41 +0100
changeset 48442 c8ca21962ff4
parent 48439 9cf5ac8c7109
child 48443 112184713852
dirstate: Document Timestamp.second_ambiguous Differential Revision: https://phab.mercurial-scm.org/D11888
mercurial/dirstateutils/timestamp.py
--- a/mercurial/dirstateutils/timestamp.py	Tue Dec 07 12:34:58 2021 +0100
+++ b/mercurial/dirstateutils/timestamp.py	Thu Dec 09 10:23:41 2021 +0100
@@ -21,13 +21,16 @@
     A Unix timestamp with optional nanoseconds precision,
     modulo 2**31 seconds.
 
-    A 2-tuple containing:
+    A 3-tuple containing:
 
     `truncated_seconds`: seconds since the Unix epoch,
     truncated to its lower 31 bits
 
     `subsecond_nanoseconds`: number of nanoseconds since `truncated_seconds`.
     When this is zero, the sub-second precision is considered unknown.
+
+    `second_ambiguous`: whether this timestamp is still "reliable"
+    (see `reliable_mtime_of`) if we drop its sub-second component.
     """
 
     def __new__(cls, value):
@@ -93,7 +96,8 @@
 
 
 def reliable_mtime_of(stat_result, present_mtime):
-    """same as `mtime_of`, but return None if the date might be ambiguous
+    """Same as `mtime_of`, but return `None` or a `Timestamp` with
+    `second_ambiguous` set if the date might be ambiguous.
 
     A modification time is reliable if it is older than "present_time" (or
     sufficiently in the future).