Mercurial > public > mercurial-scm > hg-stable
comparison rust/hg-core/src/dirstate_tree/dispatch.rs @ 47123:33e5511b571a
rust: Remove DirstateMap::file_fold_map
This was a HashMap constructed on demand and then cached in the DirstateMap
struct to avoid reconstructing at the next access. However the only use is
in Python bindings converting it to a PyDict. That method in turn is wrapped
in a @cachedproperty in Python code.
This was two redudant layers of caching. This changeset removes the Rust-level
one to keep the Python dict cache, and have bindings create a PyDict by
iterating.
Differential Revision: https://phab.mercurial-scm.org/D10493
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 13 Apr 2021 17:02:58 +0200 |
parents | e3cebe96c0fc |
children | 9c6b458a08e1 |
comparison
equal
deleted
inserted
replaced
47122:e3cebe96c0fc | 47123:33e5511b571a |
---|---|
9 use crate::DirstateMap; | 9 use crate::DirstateMap; |
10 use crate::DirstateMapError; | 10 use crate::DirstateMapError; |
11 use crate::DirstateParents; | 11 use crate::DirstateParents; |
12 use crate::DirstateStatus; | 12 use crate::DirstateStatus; |
13 use crate::EntryState; | 13 use crate::EntryState; |
14 use crate::FastHashMap; | |
15 use crate::HgPathCow; | 14 use crate::HgPathCow; |
16 use crate::PatternFileWarning; | 15 use crate::PatternFileWarning; |
17 use crate::StateMapIter; | 16 use crate::StateMapIter; |
18 use crate::StatusError; | 17 use crate::StatusError; |
19 use crate::StatusOptions; | 18 use crate::StatusOptions; |
90 fn pack( | 89 fn pack( |
91 &mut self, | 90 &mut self, |
92 parents: DirstateParents, | 91 parents: DirstateParents, |
93 now: Timestamp, | 92 now: Timestamp, |
94 ) -> Result<Vec<u8>, DirstateError>; | 93 ) -> Result<Vec<u8>, DirstateError>; |
95 | |
96 fn build_file_fold_map(&mut self) -> &FastHashMap<HgPathBuf, HgPathBuf>; | |
97 | 94 |
98 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError>; | 95 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError>; |
99 | 96 |
100 fn set_dirs(&mut self) -> Result<(), DirstateMapError>; | 97 fn set_dirs(&mut self) -> Result<(), DirstateMapError>; |
101 | 98 |
255 &mut self, | 252 &mut self, |
256 parents: DirstateParents, | 253 parents: DirstateParents, |
257 now: Timestamp, | 254 now: Timestamp, |
258 ) -> Result<Vec<u8>, DirstateError> { | 255 ) -> Result<Vec<u8>, DirstateError> { |
259 self.pack(parents, now) | 256 self.pack(parents, now) |
260 } | |
261 | |
262 fn build_file_fold_map(&mut self) -> &FastHashMap<HgPathBuf, HgPathBuf> { | |
263 self.build_file_fold_map() | |
264 } | 257 } |
265 | 258 |
266 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError> { | 259 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError> { |
267 self.set_all_dirs() | 260 self.set_all_dirs() |
268 } | 261 } |