diff 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
line wrap: on
line diff
--- a/rust/hg-core/src/config/layer.rs	Wed Mar 03 20:02:07 2021 +0100
+++ b/rust/hg-core/src/config/layer.rs	Thu Mar 04 10:58:43 2021 +0100
@@ -115,6 +115,14 @@
         Some(self.sections.get(section)?.get(item)?)
     }
 
+    /// Returns the keys defined in the given section
+    pub fn iter_keys(&self, section: &[u8]) -> impl Iterator<Item = &[u8]> {
+        self.sections
+            .get(section)
+            .into_iter()
+            .flat_map(|section| section.keys().map(|vec| &**vec))
+    }
+
     pub fn is_empty(&self) -> bool {
         self.sections.is_empty()
     }