Skip to content

Commit 7d16025

Browse files
Muir Mandersfacebook-github-bot
authored andcommitted
localrepo: kill non-rust "create" code path
Summary: init.use-rust=True is effectively enabled everywhere, so we can kill the non-rust code now. This simplifies things and allows us to depend on the rust repo object for more stuff in Python. Reviewed By: sggutier Differential Revision: D39037645 fbshipit-source-id: 101d9b97ebf0505883f62cb72df0e543764257da
1 parent b21f8ff commit 7d16025

File tree

2 files changed

+9
-51
lines changed

2 files changed

+9
-51
lines changed

eden/scm/edenscm/localrepo.py

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,9 @@ class localrepository(object):
404404
_lockfreeprefix = set()
405405

406406
def __init__(self, baseui, path, create=False):
407-
if create and baseui.configbool("init", "use-rust"):
407+
if create:
408408
bindings.repo.repo.initialize(path, baseui._rcfg)
409-
create = False
409+
410410
self._containscount = 0
411411
self.requirements = set()
412412
self.storerequirements = set()
@@ -444,26 +444,8 @@ def __init__(self, baseui, path, create=False):
444444
# This list it to be filled by extension during repo setup
445445
self._phasedefaults = []
446446

447-
# Create the initial directory if it doesn't already exist.
448-
created = False
449447
if not self.localvfs.isdir():
450-
if create:
451-
created = True
452-
# Create initial directory. Just enough to allow basic config
453-
# loading.
454-
if not self.wvfs.exists():
455-
self.wvfs.makedirs()
456-
self.localvfs.makedir(notindexed=True)
457-
else:
458-
raise errormod.RepoError(_("repository %s not found") % path)
459-
elif create:
460-
raise errormod.RepoError(_("repository %s already exists") % path)
461-
462-
# Prepare .hg/reponame in localvfs before calling into dynamicconfig.
463-
if created:
464-
reponame = self.ui.config("remotefilelog", "reponame")
465-
if reponame and not self.localvfs.exists("reponame"):
466-
self.localvfs.writeutf8("reponame", reponame.strip())
448+
raise errormod.RepoError(_("repository %s not found") % path)
467449

468450
self.ui.loadrepoconfig(self.root)
469451

@@ -487,25 +469,11 @@ def __init__(self, baseui, path, create=False):
487469
if engine.revlogheader():
488470
self.supported.add("exp-compression-%s" % name)
489471

490-
if created:
491-
self.requirements = newreporequirements(self)
492-
if "store" in self.requirements:
493-
self.storerequirements = newrepostorerequirements(self)
494-
495-
self.localvfs.mkdir("store")
496-
497-
# create an invalid changelog
498-
self.localvfs.append(
499-
"00changelog.i",
500-
b"\0\0\0\1"
501-
b" dummy changelog to prevent using the old repo layout",
502-
)
503-
else:
504-
try:
505-
self.requirements = scmutil.readrequires(self.localvfs, self.supported)
506-
except IOError as inst:
507-
if inst.errno != errno.ENOENT:
508-
raise
472+
try:
473+
self.requirements = scmutil.readrequires(self.localvfs, self.supported)
474+
except IOError as inst:
475+
if inst.errno != errno.ENOENT:
476+
raise
509477

510478
cachepath = self.localvfs.join("cache")
511479
self.sharedpath = self.path
@@ -537,12 +505,6 @@ def __init__(self, baseui, path, create=False):
537505
raise
538506
self.sharedvfs = self.localvfs
539507

540-
# If this is a new repo, generate the dynamic configs. We must do this
541-
# after the sharedvfs is set up so we can generate the dynamic config in
542-
# the shared vfs.
543-
if created:
544-
self.ui.reloadconfigs(self.root)
545-
546508
self.store = store.store(
547509
self.requirements,
548510
self.sharedpath,
@@ -564,7 +526,7 @@ def __init__(self, baseui, path, create=False):
564526
self.svfs.vfs.audit = self._getsvfsward(self.svfs.vfs.audit)
565527
else: # standard vfs
566528
self.svfs.audit = self._getsvfsward(self.svfs.audit)
567-
if not create and "store" in self.requirements:
529+
if "store" in self.requirements:
568530
try:
569531
self.storerequirements = scmutil.readrequires(
570532
self.svfs, self.storesupported
@@ -573,9 +535,6 @@ def __init__(self, baseui, path, create=False):
573535
if inst.errno != errno.ENOENT:
574536
raise
575537

576-
if create:
577-
self._writerequirements()
578-
self._writestorerequirements()
579538
if "hgsql" in self.requirements:
580539
# hgsql wants raw access to revlog. Disable modern features
581540
# unconditionally for hgsql.

eden/scm/tests/test-debugdynamicconfig.t

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ Clear the cached, non-repo dynamic config
236236
Config mismatch: foo.bar has 'None' (dynamic) vs 'True' (file)
237237
Config mismatch: foo.bar has 'None' (dynamic) vs 'True' (file)
238238
Config mismatch: foo.bar has 'None' (dynamic) vs 'True' (file)
239-
Config mismatch: foo.bar has 'None' (dynamic) vs 'True' (file)
240239
no changes found
241240
Hook ran!
242241
updating to branch default

0 commit comments

Comments
 (0)