Skip to content

Commit e448831

Browse files
Muir Mandersfacebook-github-bot
authored andcommitted
config: fix duplicate config loading for .sl repos
Summary: Now the ui stores an identity object. The identity starts off as the default environment identity, but when a repo is loaded we sniff the identity from the repo's dot dir. We use the identity to fix the check as to whether the repo's hgrc has already been loaded. Reviewed By: DurhamG Differential Revision: D39105267 fbshipit-source-id: 9d726af125a3167df054841eb1f18a018e01e615
1 parent c909064 commit e448831

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

eden/scm/edenscm/ui.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ def __init__(self, src=None, rcfg=None):
231231
self.cliconfigs = src.cliconfigs.copy()
232232
self.cliconfigfiles = src.cliconfigfiles.copy()
233233
self.clioptions = src.clioptions.copy()
234+
235+
self.identity = src.identity
234236
else:
235237
self._uiconfig = uiconfig.uiconfig(rcfg=rcfg)
236238

@@ -250,6 +252,8 @@ def __init__(self, src=None, rcfg=None):
250252

251253
self.metrics = metrics.metrics(self)
252254

255+
self.identity = bindings.identity.sniffenv()
256+
253257
allowed = self.configlist("experimental", "exportableenviron")
254258
if "*" in allowed:
255259
self._exportableenviron = self.environ
@@ -272,8 +276,13 @@ def reloadconfigs(self, repopath=None):
272276

273277
def loadrepoconfig(self, repopath):
274278
"""Load repofull config from repopath if not already loaded."""
279+
280+
ident = bindings.identity.sniffdir(repopath)
281+
if ident:
282+
self.identity = ident
283+
275284
loadedfiles = self._rcfg.files()
276-
repohgrc = os.path.join(repopath, ".hg", "hgrc")
285+
repohgrc = os.path.join(repopath, self.identity.dotdir(), "hgrc")
277286

278287
# Check if our repo hgrc path (or Windows UNC flavor) have already been loaded.
279288
if not any(lf in {repohgrc, f"\\\\?\\{repohgrc}"} for lf in loadedfiles):

eden/scm/tests/test-identity.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Clone can create a ".sl" repo.
5454

5555
$ cd cloned
5656
Status kind of runs, but doesn't ignore ".sl" properly (for non-watchman)
57-
$ hg status | head -1
57+
$ LOG=configparser::hg=info hg status | head -1
5858
? .sl/.dir_lock (?)
59+
INFO configparser::hg: loading config repo_path=Some("$TESTTMP/clone_me/cloned")
5960

0 commit comments

Comments
 (0)