diff rust/hg-core/src/config/config.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 60fe9ebae29b
children 1a036d33bc18
line wrap: on
line diff
--- a/rust/hg-core/src/config/config.rs	Wed Mar 03 20:02:07 2021 +0100
+++ b/rust/hg-core/src/config/config.rs	Thu Mar 04 10:58:43 2021 +0100
@@ -14,6 +14,7 @@
 };
 use crate::utils::files::get_bytes_from_os_str;
 use format_bytes::{write_bytes, DisplayBytes};
+use std::collections::HashSet;
 use std::env;
 use std::path::{Path, PathBuf};
 use std::str;
@@ -361,6 +362,14 @@
         None
     }
 
+    /// Return all keys defined for the given section
+    pub fn get_section_keys(&self, section: &[u8]) -> HashSet<&[u8]> {
+        self.layers
+            .iter()
+            .flat_map(|layer| layer.iter_keys(section))
+            .collect()
+    }
+
     /// Get raw values bytes from all layers (even untrusted ones) in order
     /// of precedence.
     #[cfg(test)]