comparison rust/hg-core/src/dirstate_tree/dispatch.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 e061a1df32a8
children e3cebe96c0fc
comparison
equal deleted inserted replaced
47100:caa3031c9ed5 47101:5d62243c7732
1 use std::path::PathBuf; 1 use std::path::PathBuf;
2 use std::time::Duration; 2
3 3 use crate::dirstate::parsers::Timestamp;
4 use crate::matchers::Matcher; 4 use crate::matchers::Matcher;
5 use crate::utils::hg_path::{HgPath, HgPathBuf}; 5 use crate::utils::hg_path::{HgPath, HgPathBuf};
6 use crate::CopyMapIter; 6 use crate::CopyMapIter;
7 use crate::DirstateEntry; 7 use crate::DirstateEntry;
8 use crate::DirstateError; 8 use crate::DirstateError;
88 ) -> Result<Option<&'a DirstateParents>, DirstateError>; 88 ) -> Result<Option<&'a DirstateParents>, DirstateError>;
89 89
90 fn pack( 90 fn pack(
91 &mut self, 91 &mut self,
92 parents: DirstateParents, 92 parents: DirstateParents,
93 now: Duration, 93 now: Timestamp,
94 ) -> Result<Vec<u8>, DirstateError>; 94 ) -> Result<Vec<u8>, DirstateError>;
95 95
96 fn build_file_fold_map(&mut self) -> &FastHashMap<HgPathBuf, HgPathBuf>; 96 fn build_file_fold_map(&mut self) -> &FastHashMap<HgPathBuf, HgPathBuf>;
97 97
98 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError>; 98 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError>;
252 } 252 }
253 253
254 fn pack( 254 fn pack(
255 &mut self, 255 &mut self,
256 parents: DirstateParents, 256 parents: DirstateParents,
257 now: Duration, 257 now: Timestamp,
258 ) -> Result<Vec<u8>, DirstateError> { 258 ) -> Result<Vec<u8>, DirstateError> {
259 self.pack(parents, now) 259 self.pack(parents, now)
260 } 260 }
261 261
262 fn build_file_fold_map(&mut self) -> &FastHashMap<HgPathBuf, HgPathBuf> { 262 fn build_file_fold_map(&mut self) -> &FastHashMap<HgPathBuf, HgPathBuf> {