Mercurial > hg
diff rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 48023:357307feaf61
debugstate: Always call dirstatemap.debug_iter()
… passing it a new `all` argument for the `--all` CLI option,
instead of conditionally calling `.debug_iter()` or `.items()`
This prepares for the next commit.
Differential Revision: https://phab.mercurial-scm.org/D11462
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 20 Sep 2021 19:59:09 +0200 |
parents | f2a9db29cb2d |
children | 1b2ee68e85f9 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Fri Sep 17 13:33:45 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Mon Sep 20 19:59:09 2021 +0200 @@ -1289,6 +1289,7 @@ fn debug_iter( &self, + all: bool, ) -> Box< dyn Iterator< Item = Result< @@ -1298,16 +1299,17 @@ > + Send + '_, > { - Box::new(self.iter_nodes().map(move |node| { - let node = node?; + Box::new(filter_map_results(self.iter_nodes(), move |node| { let debug_tuple = if let Some(entry) = node.entry()? { entry.debug_tuple() + } else if !all { + return Ok(None); } else if let Some(mtime) = node.cached_directory_mtime() { (b' ', 0, -1, mtime.seconds() as i32) } else { (b' ', 0, -1, -1) }; - Ok((node.full_path(self.on_disk)?, debug_tuple)) + Ok(Some((node.full_path(self.on_disk)?, debug_tuple))) })) } }