diff rust/hg-core/src/dirstate/entry.rs @ 48399:af303ae33cd7

dirstate-item: implement the comparison logic for mtime-second-ambiguous If the flag is set we now process it properly. We "just" need to actually set it and persist it. Differential Revision: https://phab.mercurial-scm.org/D11843
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 24 Nov 2021 04:51:05 +0100
parents 111098af6356
children 0b3f3a3ca50a
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/entry.rs	Wed Nov 24 04:40:00 2021 +0100
+++ b/rust/hg-core/src/dirstate/entry.rs	Wed Nov 24 04:51:05 2021 +0100
@@ -130,10 +130,17 @@
     /// in that way, doing a simple comparison would cause many false
     /// negatives.
     pub fn likely_equal(self, other: Self) -> bool {
-        self.truncated_seconds == other.truncated_seconds
-            && (self.nanoseconds == other.nanoseconds
-                || self.nanoseconds == 0
-                || other.nanoseconds == 0)
+        if self.truncated_seconds != other.truncated_seconds {
+            false
+        } else if self.nanoseconds == 0 || other.nanoseconds == 0 {
+            if self.second_ambiguous {
+                false
+            } else {
+                true
+            }
+        } else {
+            self.nanoseconds == other.nanoseconds
+        }
     }
 
     pub fn likely_equal_to_mtime_of(