Mercurial > hg
diff rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 47351:3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
`hg debugdirstate --dirs` also shows information stored in the dirstate
(for `read_dir` caching) about directories.
Differential Revision: https://phab.mercurial-scm.org/D10828
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 31 May 2021 19:54:41 +0200 |
parents | 7138c863d0a1 |
children | 9d58e54b5966 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Mon May 31 18:35:44 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Mon May 31 19:54:41 2021 +0200 @@ -319,7 +319,7 @@ pub(super) fn cached_directory_mtime( &self, - ) -> Option<&on_disk::Timestamp> { + ) -> Option<&'tree on_disk::Timestamp> { match self { NodeRef::InMemory(_path, node) => match &node.data { NodeData::CachedDirectory { mtime } => Some(mtime), @@ -1068,4 +1068,28 @@ }) })) } + + fn iter_directories( + &self, + ) -> Box< + dyn Iterator< + Item = Result< + (&HgPath, Option<Timestamp>), + DirstateV2ParseError, + >, + > + Send + + '_, + > { + Box::new(filter_map_results(self.iter_nodes(), move |node| { + Ok(if node.state()?.is_none() { + Some(( + node.full_path(self.on_disk)?, + node.cached_directory_mtime() + .map(|mtime| Timestamp(mtime.seconds())), + )) + } else { + None + }) + })) + } }