Skip to content

Commit 3c6d244

Browse files
Muir Mandersfacebook-github-bot
authored andcommitted
localrepo: reorder init steps so Rust repo is available sooner
Summary: No functional impact intended. I want to start depending more on the Rust repo object, and that requires having it be initialized earlier. Reviewed By: sggutier Differential Revision: D39037642 fbshipit-source-id: 8e6b9a0e2cc994394d351d27f03a8619f672b1c7
1 parent 7d16025 commit 3c6d244

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

eden/scm/edenscm/localrepo.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,23 @@ def __init__(self, baseui, path, create=False):
407407
if create:
408408
bindings.repo.repo.initialize(path, baseui._rcfg)
409409

410+
if not bindings.identity.sniffdir(path):
411+
raise errormod.RepoError(_("repository %s not found") % path)
412+
410413
self._containscount = 0
411414
self.requirements = set()
412415
self.storerequirements = set()
416+
413417
# wvfs: rooted at the repository root, used to access the working copy
414418
self.wvfs = vfsmod.vfs(path, expandpath=True, realpath=True, cacheaudited=False)
419+
self.root = self.wvfs.base
420+
421+
self.baseui = baseui
422+
self.ui = baseui.copy()
423+
self.ui.loadrepoconfig(self.root)
424+
425+
self._rsrepo = bindings.repo.repo(self.root, self.ui._rcfg)
426+
415427
# localvfs: rooted at .hg, used to access repo files outside of
416428
# the store that are local to this working copy.
417429
self.localvfs = None
@@ -422,7 +434,6 @@ def __init__(self, baseui, path, create=False):
422434
# If this is a shared repository, this vfs may point to another
423435
# repository's .hg/store directory.
424436
self.svfs = None
425-
self.root = self.wvfs.base
426437
self.path = self.wvfs.join(".hg")
427438
self.origroot = path
428439
# This is only used by context.workingctx.match in order to
@@ -431,8 +442,6 @@ def __init__(self, baseui, path, create=False):
431442
# This is only used by context.basectx.match in order to detect
432443
# files in forbidden paths..
433444
self.nofsauditor = pathutil.pathauditor(self.root, realfs=False, cached=True)
434-
self.baseui = baseui
435-
self.ui = baseui.copy()
436445
self.localvfs = vfsmod.vfs(self.path, cacheaudited=True)
437446
if self.ui.configbool("devel", "all-warnings") or self.ui.configbool(
438447
"devel", "check-locks"
@@ -444,14 +453,6 @@ def __init__(self, baseui, path, create=False):
444453
# This list it to be filled by extension during repo setup
445454
self._phasedefaults = []
446455

447-
if not self.localvfs.isdir():
448-
raise errormod.RepoError(_("repository %s not found") % path)
449-
450-
self.ui.loadrepoconfig(self.root)
451-
452-
# Setting the inner Rust repo should only be done when the filesystem actually exists
453-
self._rsrepo = bindings.repo.repo(self.root, self.ui._rcfg)
454-
455456
self._loadextensions()
456457

457458
cacheaudited = self.ui.configbool("unsafe", "wvfsauditorcache")

eden/scm/tests/test-clone.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ Inaccessible source
455455
$ mkdir a
456456
$ chmod 000 a
457457
$ hg clone a b
458-
abort: repository a not found!
458+
abort: Permission denied (os error 13)
459459
[255]
460460

461461
Inaccessible destination

eden/scm/tests/test-pull-update.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
$ cp -R . $TESTTMP/tt-2
138138
$ cd $TESTTMP/tt-2
139139

140-
$ hg pull -u '$TESTTMP/t#active-after-pull'
140+
$ hg pull -u "$TESTTMP/t#active-after-pull"
141141
pulling from $TESTTMP/t
142142
searching for changes
143143
adding changesets

0 commit comments

Comments
 (0)