comparison 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
comparison
equal deleted inserted replaced
46732:60fe9ebae29b 46733:1bac7764ceef
12 use crate::config::layer::{ 12 use crate::config::layer::{
13 ConfigError, ConfigLayer, ConfigOrigin, ConfigValue, 13 ConfigError, ConfigLayer, ConfigOrigin, ConfigValue,
14 }; 14 };
15 use crate::utils::files::get_bytes_from_os_str; 15 use crate::utils::files::get_bytes_from_os_str;
16 use format_bytes::{write_bytes, DisplayBytes}; 16 use format_bytes::{write_bytes, DisplayBytes};
17 use std::collections::HashSet;
17 use std::env; 18 use std::env;
18 use std::path::{Path, PathBuf}; 19 use std::path::{Path, PathBuf};
19 use std::str; 20 use std::str;
20 21
21 use crate::errors::{HgResultExt, IoResultExt}; 22 use crate::errors::{HgResultExt, IoResultExt};
359 } 360 }
360 } 361 }
361 None 362 None
362 } 363 }
363 364
365 /// Return all keys defined for the given section
366 pub fn get_section_keys(&self, section: &[u8]) -> HashSet<&[u8]> {
367 self.layers
368 .iter()
369 .flat_map(|layer| layer.iter_keys(section))
370 .collect()
371 }
372
364 /// Get raw values bytes from all layers (even untrusted ones) in order 373 /// Get raw values bytes from all layers (even untrusted ones) in order
365 /// of precedence. 374 /// of precedence.
366 #[cfg(test)] 375 #[cfg(test)]
367 fn get_all(&self, section: &[u8], item: &[u8]) -> Vec<&[u8]> { 376 fn get_all(&self, section: &[u8], item: &[u8]) -> Vec<&[u8]> {
368 let mut res = vec![]; 377 let mut res = vec![];