comparison rust/hg-core/src/config/layer.rs @ 46733:1bac7764ceef

rhg: Fall back to Python if unsupported extensions are enabled Extensions might affect behavior in ways we can’t anticipate, so just ignoring them is not correct. Later we’ll add opt-in configuration to ignore specific extensions. Differential Revision: https://phab.mercurial-scm.org/D10112
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 04 Mar 2021 10:58:43 +0100
parents 3d692e724d06
children 12d59eec7f1d
comparison
equal deleted inserted replaced
46732:60fe9ebae29b 46733:1bac7764ceef
111 } 111 }
112 112
113 /// Returns the config value in `<section>.<item>` if it exists 113 /// Returns the config value in `<section>.<item>` if it exists
114 pub fn get(&self, section: &[u8], item: &[u8]) -> Option<&ConfigValue> { 114 pub fn get(&self, section: &[u8], item: &[u8]) -> Option<&ConfigValue> {
115 Some(self.sections.get(section)?.get(item)?) 115 Some(self.sections.get(section)?.get(item)?)
116 }
117
118 /// Returns the keys defined in the given section
119 pub fn iter_keys(&self, section: &[u8]) -> impl Iterator<Item = &[u8]> {
120 self.sections
121 .get(section)
122 .into_iter()
123 .flat_map(|section| section.keys().map(|vec| &**vec))
116 } 124 }
117 125
118 pub fn is_empty(&self) -> bool { 126 pub fn is_empty(&self) -> bool {
119 self.sections.is_empty() 127 self.sections.is_empty()
120 } 128 }