diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs +++ b/rust/rhg/src/main.rs @@ -687,13 +687,18 @@ fn check_extensions(config: &Config) -> } let enabled: HashSet<&[u8]> = config - .get_section_keys(b"extensions") - .into_iter() - .map(|extension| { + .iter_section(b"extensions") + .filter_map(|(extension, value)| { + if value == b"!" { + // Filter out disabled extensions + return None; + } // Ignore extension suboptions. Only `required` exists for now. // `rhg` either supports an extension or doesn't, so it doesn't // make sense to consider the loading of an extension. - extension.split_2(b':').unwrap_or((extension, b"")).0 + let actual_extension = + extension.split_2(b':').unwrap_or((extension, b"")).0; + Some(actual_extension) }) .collect(); diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -2157,6 +2157,8 @@ test -u/-k for problematic encoding ... '''.encode('utf-8')) and None $ sh < setup.sh +#if no-rhg + test in problematic encoding >>> with open('test.sh', 'wb') as f: ... f.write(u''' @@ -2179,6 +2181,8 @@ test in problematic encoding 3 1 +#endif + $ cd .. test hg log on non-existent files and on directories