Show More
@@ -13,7 +13,6 b' use crate::config::layer::{' | |||
|
13 | 13 | ConfigError, ConfigLayer, ConfigOrigin, ConfigValue, |
|
14 | 14 | }; |
|
15 | 15 | use crate::utils::files::get_bytes_from_os_str; |
|
16 | use crate::utils::SliceExt; | |
|
17 | 16 | use format_bytes::{write_bytes, DisplayBytes}; |
|
18 | 17 | use std::collections::HashSet; |
|
19 | 18 | use std::env; |
@@ -362,32 +361,6 b' impl Config {' | |||
|
362 | 361 | Ok(self.get_option(section, item)?.unwrap_or(false)) |
|
363 | 362 | } |
|
364 | 363 | |
|
365 | /// Returns the corresponding list-value in the config if found, or `None`. | |
|
366 | /// | |
|
367 | /// This is appropriate for new configuration keys. The value syntax is | |
|
368 | /// **not** the same as most existing list-valued config, which has Python | |
|
369 | /// parsing implemented in `parselist()` in | |
|
370 | /// `mercurial/utils/stringutil.py`. Faithfully porting that parsing | |
|
371 | /// algorithm to Rust (including behavior that are arguably bugs) | |
|
372 | /// turned out to be non-trivial and hasn’t been completed as of this | |
|
373 | /// writing. | |
|
374 | /// | |
|
375 | /// Instead, the "simple" syntax is: split on comma, then trim leading and | |
|
376 | /// trailing whitespace of each component. Quotes or backslashes are not | |
|
377 | /// interpreted in any way. Commas are mandatory between values. Values | |
|
378 | /// that contain a comma are not supported. | |
|
379 | pub fn get_simple_list( | |
|
380 | &self, | |
|
381 | section: &[u8], | |
|
382 | item: &[u8], | |
|
383 | ) -> Option<impl Iterator<Item = &[u8]>> { | |
|
384 | self.get(section, item).map(|value| { | |
|
385 | value | |
|
386 | .split(|&byte| byte == b',') | |
|
387 | .map(|component| component.trim()) | |
|
388 | }) | |
|
389 | } | |
|
390 | ||
|
391 | 364 | /// If there is an `item` value in `section`, parse and return a list of |
|
392 | 365 | /// byte strings. |
|
393 | 366 | pub fn get_list( |
@@ -567,11 +567,10 b' fn check_extensions(config: &Config) -> ' | |||
|
567 | 567 | unsupported.remove(supported); |
|
568 | 568 | } |
|
569 | 569 | |
|
570 | if let Some(ignored_list) = | |
|
571 | config.get_simple_list(b"rhg", b"ignored-extensions") | |
|
570 | if let Some(ignored_list) = config.get_list(b"rhg", b"ignored-extensions") | |
|
572 | 571 | { |
|
573 | 572 | for ignored in ignored_list { |
|
574 | unsupported.remove(ignored); | |
|
573 | unsupported.remove(ignored.as_slice()); | |
|
575 | 574 | } |
|
576 | 575 | } |
|
577 | 576 |
General Comments 0
You need to be logged in to leave comments.
Login now