Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/config/layer.rs @ 46638:1f55cd5b292f
rust: Add a log file rotation utility
This is ported to Rust from `mercurial/loggingutil.py`.
The "builder" pattern is used to make it visible at call sites what the two
numeric parameters mean. In Python they might simply by keyword arguments.
Differential Revision: https://phab.mercurial-scm.org/D10010
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 11 Feb 2021 15:51:11 +0100 |
parents | a25033eb43b5 |
children | 28a54c128e82 |
line wrap: on
line diff
--- a/rust/hg-core/src/config/layer.rs Tue Feb 16 15:22:20 2021 +0100 +++ b/rust/hg-core/src/config/layer.rs Thu Feb 11 15:51:11 2021 +0100 @@ -150,7 +150,8 @@ // `Path::join` with an absolute argument correctly ignores the // base path let filename = dir.join(&get_path_from_bytes(&filename_bytes)); - let data = std::fs::read(&filename).for_file(&filename)?; + let data = + std::fs::read(&filename).when_reading_file(&filename)?; layers.push(current_layer); layers.extend(Self::parse(&filename, &data)?); current_layer = Self::new(ConfigOrigin::File(src.to_owned()));