comparison 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
comparison
equal deleted inserted replaced
48259:84f6b0c41b90 48260:269ff8978086
105 ) = NODE.unpack(node_bytes) 105 ) = NODE.unpack(node_bytes)
106 106
107 # Parse child nodes of this node recursively 107 # Parse child nodes of this node recursively
108 parse_nodes(map, copy_map, data, children_start, children_count) 108 parse_nodes(map, copy_map, data, children_start, children_count)
109 109
110 item = parsers.DirstateItem.from_v2_data(flags, size, mtime_s) 110 # Don’t yet use sub-second precision if it exists in the file,
111 # since other parts of the code still set it to zero.
112 mtime_ns = 0
113 item = parsers.DirstateItem.from_v2_data(flags, size, mtime_s, mtime_ns)
111 if not item.any_tracked: 114 if not item.any_tracked:
112 continue 115 continue
113 path = slice_with_len(data, path_start, path_len) 116 path = slice_with_len(data, path_start, path_len)
114 map[path] = item 117 map[path] = item
115 if copy_source_start: 118 if copy_source_start:
145 copy_source_len = len(copy) 148 copy_source_len = len(copy)
146 else: 149 else:
147 copy_source_start = 0 150 copy_source_start = 0
148 copy_source_len = 0 151 copy_source_len = 0
149 if entry is not None: 152 if entry is not None:
150 flags, size, mtime_s = entry.v2_data() 153 flags, size, mtime_s, mtime_ns = entry.v2_data()
151 mtime_ns = 0
152 else: 154 else:
153 # There are no mtime-cached directories in the Python implementation 155 # There are no mtime-cached directories in the Python implementation
154 flags = 0 156 flags = 0
155 size = 0 157 size = 0
156 mtime_s = 0 158 mtime_s = 0
247 249
248 The root node is not serialized in the format, but its information is 250 The root node is not serialized in the format, but its information is
249 written to the docket. Again, see more details on the on-disk format in 251 written to the docket. Again, see more details on the on-disk format in
250 `mercurial/helptext/internals/dirstate-v2`. 252 `mercurial/helptext/internals/dirstate-v2`.
251 """ 253 """
252 now = int(now)
253 data = bytearray() 254 data = bytearray()
254 root_nodes_start = 0 255 root_nodes_start = 0
255 root_nodes_len = 0 256 root_nodes_len = 0
256 nodes_with_entry_count = 0 257 nodes_with_entry_count = 0
257 nodes_with_copy_source_count = 0 258 nodes_with_copy_source_count = 0