comparison rust/hg-core/src/dirstate/status.rs @ 47113:be579775c2d9

dirstate-tree: Add the new `status()` algorithm With the dirstate organized in a tree that mirrors the structure of the filesystem tree, we can traverse both trees at the same time in order to compare them. This is hopefully more efficient that building multiple big hashmaps for all of the repository’s contents. Differential Revision: https://phab.mercurial-scm.org/D10547
author Simon Sapin <simon.sapin@octobus.net>
date Fri, 16 Apr 2021 12:12:41 +0200
parents d5956136d19d
children 717a94b423b9
comparison
equal deleted inserted replaced
47112:d5956136d19d 47113:be579775c2d9
93 }, 93 },
94 } 94 }
95 95
96 type IoResult<T> = std::io::Result<T>; 96 type IoResult<T> = std::io::Result<T>;
97 97
98 /// `Box<dyn Trait>` is syntactic sugar for `Box<dyn Trait, 'static>`, so add 98 /// `Box<dyn Trait>` is syntactic sugar for `Box<dyn Trait + 'static>`, so add
99 /// an explicit lifetime here to not fight `'static` bounds "out of nowhere". 99 /// an explicit lifetime here to not fight `'static` bounds "out of nowhere".
100 pub type IgnoreFnType<'a> = 100 pub type IgnoreFnType<'a> =
101 Box<dyn for<'r> Fn(&'r HgPath) -> bool + Sync + 'a>; 101 Box<dyn for<'r> Fn(&'r HgPath) -> bool + Sync + 'a>;
102 102
103 /// We have a good mix of owned (from directory traversal) and borrowed (from 103 /// We have a good mix of owned (from directory traversal) and borrowed (from
253 /// Whether to collect traversed dirs for applying a callback later. 253 /// Whether to collect traversed dirs for applying a callback later.
254 /// Used by `hg purge` for example. 254 /// Used by `hg purge` for example.
255 pub collect_traversed_dirs: bool, 255 pub collect_traversed_dirs: bool,
256 } 256 }
257 257
258 #[derive(Debug)] 258 #[derive(Debug, Default)]
259 pub struct DirstateStatus<'a> { 259 pub struct DirstateStatus<'a> {
260 /// Tracked files whose contents have changed since the parent revision 260 /// Tracked files whose contents have changed since the parent revision
261 pub modified: Vec<HgPathCow<'a>>, 261 pub modified: Vec<HgPathCow<'a>>,
262 262
263 /// Newly-tracked files that were not present in the parent 263 /// Newly-tracked files that were not present in the parent