diff mercurial/dirstateutils/v2.py @ 48260:269ff8978086

dirstate: store mtimes with nanosecond precision in memory Keep integer seconds since the Unix epoch, together with integer nanoseconds in the `0 <= n < 1e9` range. For now, nanoseconds are still always zero. This commit is about data structure changes. Differential Revision: https://phab.mercurial-scm.org/D11684
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 18 Oct 2021 11:23:07 +0200
parents dfc5a505ddc5
children 83d0bd45b662
line wrap: on
line diff
--- a/mercurial/dirstateutils/v2.py	Tue Oct 19 21:03:13 2021 +0200
+++ b/mercurial/dirstateutils/v2.py	Mon Oct 18 11:23:07 2021 +0200
@@ -107,7 +107,10 @@
         # Parse child nodes of this node recursively
         parse_nodes(map, copy_map, data, children_start, children_count)
 
-        item = parsers.DirstateItem.from_v2_data(flags, size, mtime_s)
+        # Don’t yet use sub-second precision if it exists in the file,
+        # since other parts of the code still set it to zero.
+        mtime_ns = 0
+        item = parsers.DirstateItem.from_v2_data(flags, size, mtime_s, mtime_ns)
         if not item.any_tracked:
             continue
         path = slice_with_len(data, path_start, path_len)
@@ -147,8 +150,7 @@
             copy_source_start = 0
             copy_source_len = 0
         if entry is not None:
-            flags, size, mtime_s = entry.v2_data()
-            mtime_ns = 0
+            flags, size, mtime_s, mtime_ns = entry.v2_data()
         else:
             # There are no mtime-cached directories in the Python implementation
             flags = 0
@@ -249,7 +251,6 @@
     written to the docket. Again, see more details on the on-disk format in
     `mercurial/helptext/internals/dirstate-v2`.
     """
-    now = int(now)
     data = bytearray()
     root_nodes_start = 0
     root_nodes_len = 0