mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
config: avoid unnecessary reponame rewrites
Summary: D35147190 (45d88665a8
) put the inner repo loading behind the `init.use-rust` config, preventing excessive rewrites for the `reponame` file for users not in the alpha build. This diff makes those excessive rewrites disappear altogether for everyone.
Reviewed By: xavierd
Differential Revision: D35176025
fbshipit-source-id: 7b26c0bde4a74c9891df6e2f8a472d1a94f80273
This commit is contained in:
parent
c6d27c97d7
commit
0d96992a96
@ -509,7 +509,7 @@ fn read_set_repo_name(config: &mut ConfigSet, repo_path: &Path) -> crate::Result
|
||||
tracing::debug!("repo name: {:?} (from {})", &repo_name, source);
|
||||
if source != ".hg/reponame" {
|
||||
let need_rewrite = match read_repo_name_from_disk(repo_path) {
|
||||
Ok(s) => s == repo_name,
|
||||
Ok(s) => s != repo_name,
|
||||
Err(_) => true,
|
||||
};
|
||||
if need_rewrite {
|
||||
|
16
eden/scm/tests/test-reponame-rewrite.t
Normal file
16
eden/scm/tests/test-reponame-rewrite.t
Normal file
@ -0,0 +1,16 @@
|
||||
#chg-compatible
|
||||
$ configure modern
|
||||
$ newrepo
|
||||
|
||||
Make sure we do not rewrite by default:
|
||||
$ cat .hg/reponame
|
||||
reponame-default (no-eol)
|
||||
$ LOG=configparser::hg=debug hg log 2>&1 | grep written
|
||||
[1]
|
||||
|
||||
Rewrite on wrong reponame:
|
||||
$ echo foobar > .hg/reponame
|
||||
$ LOG=configparser::hg=debug hg log 2>&1 | grep written
|
||||
DEBUG configparser::hg: repo name: written to .hg/reponame
|
||||
$ cat .hg/reponame
|
||||
reponame-default (no-eol)
|
Loading…
Reference in New Issue
Block a user