D10111: rhg: Sort config files when adding a directory
SimonSapin
phabricator at mercurial-scm.org
Thu Mar 4 11:11:28 UTC 2021
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
For example in `/etc/mercurial/hgrc.d/` or with `HGRCPATH=some-directory`
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D10111
AFFECTED FILES
rust/hg-core/src/config/config.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/config/config.rs b/rust/hg-core/src/config/config.rs
--- a/rust/hg-core/src/config/config.rs
+++ b/rust/hg-core/src/config/config.rs
@@ -107,8 +107,13 @@
.when_reading_file(path)
.io_not_found_as_none()?
{
- for entry in entries {
- let file_path = entry.when_reading_file(path)?.path();
+ let mut file_paths = entries
+ .map(|result| {
+ result.when_reading_file(path).map(|entry| entry.path())
+ })
+ .collect::<Result<Vec<_>, _>>()?;
+ file_paths.sort();
+ for file_path in &file_paths {
if file_path.extension() == Some(std::ffi::OsStr::new("rc")) {
self.add_trusted_file(&file_path)?
}
To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list