Skip to content

Commit c909064

Browse files
Muir Mandersfacebook-github-bot
authored andcommitted
start fixing hard coded ".hg" uses in Python
Summary: Fix some key spots so commands can start to work properly when run in a ".sl" repo. Reviewed By: DurhamG Differential Revision: D39040644 fbshipit-source-id: e9049e2c5bcaafe6ff960b23ea0d64eaac368699
1 parent ed634ef commit c909064

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

eden/scm/edenscm/cmdutil.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import tempfile
2121
from typing import Dict
2222

23-
from bindings import renderdag
23+
from bindings import identity, renderdag
2424
from edenscm import tracing
2525

2626
from . import (
@@ -882,12 +882,11 @@ def findsubcmd(args, table, partial=False):
882882

883883

884884
def findrepo(p):
885-
while not os.path.isdir(os.path.join(p, ".hg")):
886-
oldp, p = p, os.path.dirname(p)
887-
if p == oldp:
888-
return None
885+
root = identity.sniffroot(p)
886+
if root:
887+
return root[0]
889888

890-
return p
889+
return None
891890

892891

893892
def uncommittedchanges(repo):

eden/scm/edenscm/dirstate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def _checkexec(self) -> bool:
267267

268268
@util.propertycache
269269
def _checkcase(self) -> bool:
270-
return not util.fscasesensitive(self._join(".hg"))
270+
return not util.fscasesensitive(self._repo.path)
271271

272272
def _join(self, f: str) -> str:
273273
# much faster than os.path.join()

eden/scm/edenscm/localrepo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def __init__(self, baseui, path, create=False):
434434
# If this is a shared repository, this vfs may point to another
435435
# repository's .hg/store directory.
436436
self.svfs = None
437-
self.path = self.wvfs.join(".hg")
437+
self.path = self._rsrepo.dotpath()
438438
self.origroot = path
439439
# This is only used by context.workingctx.match in order to
440440
# detect files in forbidden paths.

eden/scm/edenscmnative/bindings/modules/pyrepo/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,8 @@ py_class!(pub class repo |py| {
7575
repo_ref.invalidate_dag_commits();
7676
Ok(PyNone)
7777
}
78+
79+
def dotpath(&self) -> PyResult<PyPathBuf> {
80+
self.inner(py).read().dot_hg_path().try_into().map_pyerr(py)
81+
}
7882
});

eden/scm/tests/test-identity.t

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,9 @@ Clone can create a ".sl" repo.
5151
updateprogress
5252
wlock.data
5353
wlock.lock
54+
55+
$ cd cloned
56+
Status kind of runs, but doesn't ignore ".sl" properly (for non-watchman)
57+
$ hg status | head -1
58+
? .sl/.dir_lock (?)
59+

0 commit comments

Comments
 (0)