diff rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 47101:5d62243c7732

rust: Add a Timestamp struct instead of abusing Duration `SystemTime` would be the standard library type semantically appropriate instead of `Duration`. But since the value is coming from Python as a plain integer and used in dirstate packing code as an integer, let’s make a type that contains a single integer instead of using one with sub-second precision. Differential Revision: https://phab.mercurial-scm.org/D10485
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 12 Apr 2021 14:43:45 +0200
parents caa3031c9ed5
children d6c94ca40863
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Tue Apr 06 21:07:12 2021 +0200
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs	Mon Apr 12 14:43:45 2021 +0200
@@ -1,10 +1,10 @@
 use std::collections::BTreeMap;
 use std::path::PathBuf;
-use std::time::Duration;
 
 use super::path_with_basename::WithBasename;
 use crate::dirstate::parsers::parse_dirstate_entries;
 use crate::dirstate::parsers::parse_dirstate_parents;
+use crate::dirstate::parsers::Timestamp;
 
 use crate::matchers::Matcher;
 use crate::revlog::node::NULL_NODE;
@@ -328,7 +328,7 @@
     fn pack(
         &mut self,
         _parents: DirstateParents,
-        _now: Duration,
+        _now: Timestamp,
     ) -> Result<Vec<u8>, DirstateError> {
         let _ = self.iter_node_data_mut();
         todo!()