##// END OF EJS Templates
dirstate-v2: Only convert from SystemTime to Timestamp and not back...
Simon Sapin -
r49004:0cc0c097 default
parent child Browse files
Show More
@@ -15,7 +15,7 b' use bytes_cast::BytesCast;'
15 15 use format_bytes::format_bytes;
16 16 use std::borrow::Cow;
17 17 use std::convert::{TryFrom, TryInto};
18 use std::time::{Duration, SystemTime, UNIX_EPOCH};
18 use std::time::{SystemTime, UNIX_EPOCH};
19 19
20 20 /// Added at the start of `.hg/dirstate` when the "v2" format is used.
21 21 /// This a redundant sanity check more than an actual "magic number" since
@@ -462,18 +462,6 b' impl From<SystemTime> for Timestamp {'
462 462 }
463 463 }
464 464
465 impl From<&'_ Timestamp> for SystemTime {
466 fn from(timestamp: &'_ Timestamp) -> Self {
467 let secs = timestamp.seconds.get();
468 let nanos = timestamp.nanoseconds.get();
469 if secs >= 0 {
470 UNIX_EPOCH + Duration::new(secs as u64, nanos)
471 } else {
472 UNIX_EPOCH - Duration::new((-secs) as u64, nanos)
473 }
474 }
475 }
476
477 465 fn read_hg_path(
478 466 on_disk: &[u8],
479 467 slice: PathSlice,
@@ -199,7 +199,8 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
199 199 // directory eligible for `read_dir` caching.
200 200 if let Some(meta) = directory_metadata {
201 201 if let Ok(current_mtime) = meta.modified() {
202 if current_mtime == cached_mtime.into() {
202 let current_mtime = Timestamp::from(current_mtime);
203 if current_mtime == *cached_mtime {
203 204 // The mtime of that directory has not changed
204 205 // since then, which means that the results of
205 206 // `read_dir` should also be unchanged.
General Comments 0
You need to be logged in to leave comments. Login now