comparison rust/hg-core/src/config/layer.rs @ 48490: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
comparison
equal deleted inserted replaced
48489:b5f8d9e55d42 48490:4a983b69e519
123 pub fn iter_keys(&self, section: &[u8]) -> impl Iterator<Item = &[u8]> { 123 pub fn iter_keys(&self, section: &[u8]) -> impl Iterator<Item = &[u8]> {
124 self.sections 124 self.sections
125 .get(section) 125 .get(section)
126 .into_iter() 126 .into_iter()
127 .flat_map(|section| section.keys().map(|vec| &**vec)) 127 .flat_map(|section| section.keys().map(|vec| &**vec))
128 }
129
130 /// Returns the (key, value) pairs defined in the given section
131 pub fn iter_section<'layer>(
132 &'layer self,
133 section: &[u8],
134 ) -> impl Iterator<Item = (&'layer [u8], &'layer [u8])> {
135 self.sections
136 .get(section)
137 .into_iter()
138 .flat_map(|section| section.iter().map(|(k, v)| (&**k, &*v.bytes)))
128 } 139 }
129 140
130 /// Returns whether any key is defined in the given section 141 /// Returns whether any key is defined in the given section
131 pub fn has_non_empty_section(&self, section: &[u8]) -> bool { 142 pub fn has_non_empty_section(&self, section: &[u8]) -> bool {
132 self.sections 143 self.sections