Skip to content
Snippets Groups Projects
Commit a2e278b5 authored by Simon Sapin's avatar Simon Sapin
Browse files

rhg: [encode] and [decode] config sections are not supported

Differential Revision: https://phab.mercurial-scm.org/D11761
parent f9db8eeb
No related branches found
No related tags found
No related merge requests found
......@@ -403,6 +403,13 @@
.collect()
}
/// Returns whether any key is defined in the given section
pub fn has_non_empty_section(&self, section: &[u8]) -> bool {
self.layers
.iter()
.any(|layer| layer.has_non_empty_section(section))
}
/// Get raw values bytes from all layers (even untrusted ones) in order
/// of precedence.
#[cfg(test)]
......
......@@ -127,6 +127,13 @@
.flat_map(|section| section.keys().map(|vec| &**vec))
}
/// Returns whether any key is defined in the given section
pub fn has_non_empty_section(&self, section: &[u8]) -> bool {
self.sections
.get(section)
.map_or(false, |section| !section.is_empty())
}
pub fn is_empty(&self) -> bool {
self.sections.is_empty()
}
......
......@@ -626,5 +626,13 @@
Err(CommandError::unsupported("$HG_PENDING"))?
}
if config.has_non_empty_section(b"encode") {
Err(CommandError::unsupported("[encode] config"))?
}
if config.has_non_empty_section(b"decode") {
Err(CommandError::unsupported("[decode] config"))?
}
Ok(())
}
TODO: fix rhg bugs that make this test fail when status is enabled
$ unset RHG_STATUS
Test encode/decode filters
$ hg init
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment