config: change system config entry point

Summary:
Change system config entry point to only `/etc/mercurial/system.rc` (unix) and
`\ProgramData\Facebook\Mercurial\system.rc` (Windows) so they won't overlap
with a vanilla Mercurial installation.

Another goal of this change is to make it easier to drop the directory
`%include` feature. So detecting config changes (for example, edenfs wants to
make sure ignore rules are up-to-date) can be made cheaper by just stating
files without `listdir`.

Reviewed By: markbt

Differential Revision: D13875656

fbshipit-source-id: 314c0bf87ff086dec5b88e232edca0133356484e
This commit is contained in:
Jun Wu 2019-02-08 19:27:58 -08:00 committed by Facebook Github Bot
parent 0ce06567ab
commit 9cdc2640d6

View File

@ -185,8 +185,7 @@ impl ConfigSetHgExt for ConfigSet {
#[cfg(unix)]
{
errors.append(&mut self.load_path(data_dir.join("default.d/"), &opts));
errors.append(&mut self.load_path("/etc/mercurial/hgrc", &opts));
errors.append(&mut self.load_path("/etc/mercurial/hgrc.d/", &opts));
errors.append(&mut self.load_path("/etc/mercurial/system.rc", &opts));
}
#[cfg(windows)]
@ -194,9 +193,7 @@ impl ConfigSetHgExt for ConfigSet {
errors.append(&mut self.load_path(data_dir.join("default.d/"), &opts));
if let Ok(program_data_path) = env::var("PROGRAMDATA") {
let hgrc_dir = Path::new(&program_data_path).join("Facebook\\Mercurial");
errors.append(&mut self.load_path(hgrc_dir.join("mercurial.ini"), &opts));
errors.append(&mut self.load_path(hgrc_dir.join("hgrc"), &opts));
errors.append(&mut self.load_path(hgrc_dir.join("hgrc.d/"), &opts));
errors.append(&mut self.load_path(hgrc_dir.join("system.rc"), &opts));
}
}
}