Show More
@@ -11,6 +11,7 b' use hg::exit_codes;' | |||||
11 | use hg::repo::{Repo, RepoError}; |
|
11 | use hg::repo::{Repo, RepoError}; | |
12 | use hg::utils::files::{get_bytes_from_os_str, get_path_from_bytes}; |
|
12 | use hg::utils::files::{get_bytes_from_os_str, get_path_from_bytes}; | |
13 | use hg::utils::SliceExt; |
|
13 | use hg::utils::SliceExt; | |
|
14 | use std::collections::HashSet; | |||
14 | use std::ffi::OsString; |
|
15 | use std::ffi::OsString; | |
15 | use std::path::PathBuf; |
|
16 | use std::path::PathBuf; | |
16 | use std::process::Command; |
|
17 | use std::process::Command; | |
@@ -598,11 +599,23 b' impl OnUnsupported {' | |||||
598 | } |
|
599 | } | |
599 | } |
|
600 | } | |
600 |
|
601 | |||
|
602 | /// The `*` extension is an edge-case for config sub-options that apply to all | |||
|
603 | /// extensions. For now, only `:required` exists, but that may change in the | |||
|
604 | /// future. | |||
601 | const SUPPORTED_EXTENSIONS: &[&[u8]] = |
|
605 | const SUPPORTED_EXTENSIONS: &[&[u8]] = | |
602 | &[b"blackbox", b"share", b"sparse", b"narrow"]; |
|
606 | &[b"blackbox", b"share", b"sparse", b"narrow", b"*"]; | |
603 |
|
607 | |||
604 | fn check_extensions(config: &Config) -> Result<(), CommandError> { |
|
608 | fn check_extensions(config: &Config) -> Result<(), CommandError> { | |
605 | let enabled = config.get_section_keys(b"extensions"); |
|
609 | let enabled: HashSet<&[u8]> = config | |
|
610 | .get_section_keys(b"extensions") | |||
|
611 | .into_iter() | |||
|
612 | .map(|extension| { | |||
|
613 | // Ignore extension suboptions. Only `required` exists for now. | |||
|
614 | // `rhg` either supports an extension or doesn't, so it doesn't | |||
|
615 | // make sense to consider the loading of an extension. | |||
|
616 | extension.split_2(b':').unwrap_or((extension, b"")).0 | |||
|
617 | }) | |||
|
618 | .collect(); | |||
606 |
|
619 | |||
607 | let mut unsupported = enabled; |
|
620 | let mut unsupported = enabled; | |
608 | for supported in SUPPORTED_EXTENSIONS { |
|
621 | for supported in SUPPORTED_EXTENSIONS { |
@@ -380,3 +380,13 b' Subrepos are not supported' | |||||
380 | $ rhg files |
|
380 | $ rhg files | |
381 | a |
|
381 | a | |
382 | $ rm .hgsub |
|
382 | $ rm .hgsub | |
|
383 | ||||
|
384 | The `:required` extension suboptions are correctly ignored | |||
|
385 | ||||
|
386 | $ echo "[extensions]" >> $HGRCPATH | |||
|
387 | $ echo "blackbox:required = yes" >> $HGRCPATH | |||
|
388 | $ rhg files | |||
|
389 | a | |||
|
390 | $ echo "*:required = yes" >> $HGRCPATH | |||
|
391 | $ rhg files | |||
|
392 | a |
General Comments 0
You need to be logged in to leave comments.
Login now