Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/config/config.rs @ 48733:39c447e03dbc
rhg: Add support for colored output
The same "label" system is used as in Python code
Differential Revision: https://phab.mercurial-scm.org/D12167
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 10 Feb 2022 12:59:32 +0100 |
parents | d4a5c2197208 |
children | 29eb80d190b2 |
line wrap: on
line diff
--- a/rust/hg-core/src/config/config.rs Thu Feb 10 13:56:43 2022 +0100 +++ b/rust/hg-core/src/config/config.rs Thu Feb 10 12:59:32 2022 +0100 @@ -398,6 +398,16 @@ .map(|(_, value)| value.bytes.as_ref()) } + /// Returns the raw value bytes of the first one found, or `None`. + pub fn get_with_origin( + &self, + section: &[u8], + item: &[u8], + ) -> Option<(&[u8], &ConfigOrigin)> { + self.get_inner(section, item) + .map(|(layer, value)| (value.bytes.as_ref(), &layer.origin)) + } + /// Returns the layer and the value of the first one found, or `None`. fn get_inner( &self,