Mercurial > public > mercurial-scm > hg-stable
comparison rust/hg-core/src/dirstate_tree/dispatch.rs @ 48045: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 | e5fb14a07866 |
children | 32ef647821b2 |
comparison
equal
deleted
inserted
replaced
48044:f2a9db29cb2d | 48045:357307feaf61 |
---|---|
288 | 288 |
289 /// Return an iterator of `(path, (state, mode, size, mtime))` for every | 289 /// Return an iterator of `(path, (state, mode, size, mtime))` for every |
290 /// node stored in this dirstate map, for the purpose of the `hg | 290 /// node stored in this dirstate map, for the purpose of the `hg |
291 /// debugdirstate` command. | 291 /// debugdirstate` command. |
292 /// | 292 /// |
293 /// For nodes that don’t have an entry, `state` is the ASCII space. | 293 /// If `all` is true, include nodes that don’t have an entry. |
294 /// For such nodes `state` is the ASCII space. | |
294 /// An `mtime` may still be present. It is used to optimize `status`. | 295 /// An `mtime` may still be present. It is used to optimize `status`. |
295 /// | 296 /// |
296 /// Because parse errors can happen during iteration, the iterated items | 297 /// Because parse errors can happen during iteration, the iterated items |
297 /// are `Result`s. | 298 /// are `Result`s. |
298 fn debug_iter( | 299 fn debug_iter( |
299 &self, | 300 &self, |
301 all: bool, | |
300 ) -> Box< | 302 ) -> Box< |
301 dyn Iterator< | 303 dyn Iterator< |
302 Item = Result< | 304 Item = Result< |
303 (&HgPath, (u8, i32, i32, i32)), | 305 (&HgPath, (u8, i32, i32, i32)), |
304 DirstateV2ParseError, | 306 DirstateV2ParseError, |
536 )) | 538 )) |
537 } | 539 } |
538 | 540 |
539 fn debug_iter( | 541 fn debug_iter( |
540 &self, | 542 &self, |
543 all: bool, | |
541 ) -> Box< | 544 ) -> Box< |
542 dyn Iterator< | 545 dyn Iterator< |
543 Item = Result< | 546 Item = Result< |
544 (&HgPath, (u8, i32, i32, i32)), | 547 (&HgPath, (u8, i32, i32, i32)), |
545 DirstateV2ParseError, | 548 DirstateV2ParseError, |
546 >, | 549 >, |
547 > + Send | 550 > + Send |
548 + '_, | 551 + '_, |
549 > { | 552 > { |
553 // Not used for the flat (not tree-based) DirstateMap | |
554 let _ = all; | |
555 | |
550 Box::new( | 556 Box::new( |
551 (&**self) | 557 (&**self) |
552 .iter() | 558 .iter() |
553 .map(|(path, entry)| Ok((&**path, entry.debug_tuple()))), | 559 .map(|(path, entry)| Ok((&**path, entry.debug_tuple()))), |
554 ) | 560 ) |