changeset 48449:995aaacb12d7

dirstate-item: make sure we set the mtime-second-ambiguous on v2 write We want to preserve the second-ambiguity alongside the ambiguous mtime. So we use the decimated flag for that. note: the C code was already doing so. No change was needed to it. Differential Revision: https://phab.mercurial-scm.org/D11845
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 24 Nov 2021 05:00:06 +0100
parents 0b3f3a3ca50a
children be2317167a9b
files mercurial/pure/parsers.py rust/hg-core/src/dirstate/entry.rs rust/hg-core/src/dirstate_tree/on_disk.rs
diffstat 3 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Wed Nov 24 04:59:48 2021 +0100
+++ b/mercurial/pure/parsers.py	Wed Nov 24 05:00:06 2021 +0100
@@ -483,6 +483,8 @@
                 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
         if self._mtime_s is not None:
             flags |= DIRSTATE_V2_HAS_MTIME
+        if self._mtime_second_ambiguous:
+            flags |= DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS
 
         if self._fallback_exec is not None:
             flags |= DIRSTATE_V2_HAS_FALLBACK_EXEC
--- a/rust/hg-core/src/dirstate/entry.rs	Wed Nov 24 04:59:48 2021 +0100
+++ b/rust/hg-core/src/dirstate/entry.rs	Wed Nov 24 05:00:06 2021 +0100
@@ -43,7 +43,10 @@
     truncated_seconds: u32,
     /// Always in the `0 .. 1_000_000_000` range.
     nanoseconds: u32,
-    second_ambiguous: bool,
+    /// TODO this should be in DirstateEntry, but the current code needs
+    /// refactoring to use DirstateEntry instead of TruncatedTimestamp for
+    /// comparison.
+    pub second_ambiguous: bool,
 }
 
 impl TruncatedTimestamp {
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs	Wed Nov 24 04:59:48 2021 +0100
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs	Wed Nov 24 05:00:06 2021 +0100
@@ -465,6 +465,9 @@
         };
         let mtime = if let Some(m) = mtime_opt {
             flags.insert(Flags::HAS_MTIME);
+            if m.second_ambiguous {
+                flags.insert(Flags::MTIME_SECOND_AMBIGUOUS);
+            };
             m.into()
         } else {
             PackedTruncatedTimestamp::null()