mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
configfile: skip "local" config outside a repo
Summary: Now if you run "configfile" with no args outside a repo, it will show the system and user config paths, skipping the repo/local config. Reviewed By: DurhamG Differential Revision: D41310603 fbshipit-source-id: 540679ec9f446aa24d0a1f048ae8316cc5ff23fe
This commit is contained in:
parent
12bae04f31
commit
c4a9cc2ccf
@ -57,15 +57,14 @@ pub fn run(ctx: ReqCtx<DebugConfigLocationOpts>, repo: &mut OptionalRepo) -> Res
|
||||
}
|
||||
|
||||
if show_all || ctx.opts.local {
|
||||
let repo = if let OptionalRepo::Some(repo) = repo {
|
||||
repo
|
||||
} else {
|
||||
if let OptionalRepo::Some(repo) = repo {
|
||||
if show_all {
|
||||
write!(ctx.io().output(), "Repo config path: ")?;
|
||||
}
|
||||
write!(ctx.io().output(), "{}\n", repo.config_path().display())?;
|
||||
} else if !show_all {
|
||||
abort!("--local must be used inside a repo");
|
||||
};
|
||||
if show_all {
|
||||
write!(ctx.io().output(), "Repo config path: ")?;
|
||||
}
|
||||
write!(ctx.io().output(), "{}\n", repo.config_path().display())?;
|
||||
}
|
||||
|
||||
if show_all || ctx.opts.system {
|
||||
|
@ -37,3 +37,10 @@ Test locating other configs
|
||||
$ hg configfile --system
|
||||
/etc/mercurial/system.rc (no-windows !)
|
||||
C:\ProgramData\Facebook\Mercurial\Facebook\Mercurial\system.rc (windows !)
|
||||
|
||||
Test outside a repo
|
||||
$ cd
|
||||
$ hg configfile
|
||||
User config path: $TESTTMP/.hgrc
|
||||
System config path: /etc/mercurial/system.rc (no-windows !)
|
||||
System config path: C:\ProgramData\Facebook\Mercurial\Facebook\Mercurial\system.rc (windows !)
|
||||
|
Loading…
Reference in New Issue
Block a user