comparison rust/hg-core/src/dirstate/entry.rs @ 48257:f45d35950db6

dirstate: rename a `very_likely_equal` method to `likely_equal` No need to oversell it. Differential Revision: https://phab.mercurial-scm.org/D11691
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 18 Oct 2021 19:02:40 +0200
parents b874e8d81a98
children c591944f42c1
comparison
equal deleted inserted replaced
48256:56d037d07395 48257:f45d35950db6
112 /// on filesystems that support sub-second precision. 112 /// on filesystems that support sub-second precision.
113 /// 113 ///
114 /// If someone is manipulating the modification times of some files to 114 /// If someone is manipulating the modification times of some files to
115 /// intentionally make `hg status` return incorrect results, not truncating 115 /// intentionally make `hg status` return incorrect results, not truncating
116 /// wouldn’t help much since they can set exactly the expected timestamp. 116 /// wouldn’t help much since they can set exactly the expected timestamp.
117 pub fn very_likely_equal(self, other: Self) -> bool { 117 pub fn likely_equal(self, other: Self) -> bool {
118 self.truncated_seconds == other.truncated_seconds 118 self.truncated_seconds == other.truncated_seconds
119 && self.nanoseconds == other.nanoseconds 119 && self.nanoseconds == other.nanoseconds
120 } 120 }
121 121
122 pub fn very_likely_equal_to_mtime_of( 122 pub fn likely_equal_to_mtime_of(
123 self, 123 self,
124 metadata: &fs::Metadata, 124 metadata: &fs::Metadata,
125 ) -> io::Result<bool> { 125 ) -> io::Result<bool> {
126 Ok(self.very_likely_equal(Self::for_mtime_of(metadata)?)) 126 Ok(self.likely_equal(Self::for_mtime_of(metadata)?))
127 } 127 }
128 } 128 }
129 129
130 impl From<SystemTime> for TruncatedTimestamp { 130 impl From<SystemTime> for TruncatedTimestamp {
131 fn from(system_time: SystemTime) -> Self { 131 fn from(system_time: SystemTime) -> Self {