Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/config/layer.rs @ 48451:4a983b69e519
rhg: Add support for ui.ignore and ui.ignore.* config
This fixes some but not all failures in `tests/test-hgignore.t` when running
with `rhg status` enabled.
Differential Revision: https://phab.mercurial-scm.org/D11907
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 10 Dec 2021 14:27:00 +0100 |
parents | a2e278b5e265 |
children | d4a5c2197208 |
line wrap: on
line diff
--- a/rust/hg-core/src/config/layer.rs Fri Dec 10 17:20:21 2021 +0100 +++ b/rust/hg-core/src/config/layer.rs Fri Dec 10 14:27:00 2021 +0100 @@ -127,6 +127,17 @@ .flat_map(|section| section.keys().map(|vec| &**vec)) } + /// Returns the (key, value) pairs defined in the given section + pub fn iter_section<'layer>( + &'layer self, + section: &[u8], + ) -> impl Iterator<Item = (&'layer [u8], &'layer [u8])> { + self.sections + .get(section) + .into_iter() + .flat_map(|section| section.iter().map(|(k, v)| (&**k, &*v.bytes))) + } + /// Returns whether any key is defined in the given section pub fn has_non_empty_section(&self, section: &[u8]) -> bool { self.sections