@@ -404,9 +404,9 @@ class localrepository(object):
404
404
_lockfreeprefix = set ()
405
405
406
406
def __init__ (self , baseui , path , create = False ):
407
- if create and baseui . configbool ( "init" , "use-rust" ) :
407
+ if create :
408
408
bindings .repo .repo .initialize (path , baseui ._rcfg )
409
- create = False
409
+
410
410
self ._containscount = 0
411
411
self .requirements = set ()
412
412
self .storerequirements = set ()
@@ -444,26 +444,8 @@ def __init__(self, baseui, path, create=False):
444
444
# This list it to be filled by extension during repo setup
445
445
self ._phasedefaults = []
446
446
447
- # Create the initial directory if it doesn't already exist.
448
- created = False
449
447
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 )
467
449
468
450
self .ui .loadrepoconfig (self .root )
469
451
@@ -487,25 +469,11 @@ def __init__(self, baseui, path, create=False):
487
469
if engine .revlogheader ():
488
470
self .supported .add ("exp-compression-%s" % name )
489
471
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
509
477
510
478
cachepath = self .localvfs .join ("cache" )
511
479
self .sharedpath = self .path
@@ -537,12 +505,6 @@ def __init__(self, baseui, path, create=False):
537
505
raise
538
506
self .sharedvfs = self .localvfs
539
507
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
-
546
508
self .store = store .store (
547
509
self .requirements ,
548
510
self .sharedpath ,
@@ -564,7 +526,7 @@ def __init__(self, baseui, path, create=False):
564
526
self .svfs .vfs .audit = self ._getsvfsward (self .svfs .vfs .audit )
565
527
else : # standard vfs
566
528
self .svfs .audit = self ._getsvfsward (self .svfs .audit )
567
- if not create and "store" in self .requirements :
529
+ if "store" in self .requirements :
568
530
try :
569
531
self .storerequirements = scmutil .readrequires (
570
532
self .svfs , self .storesupported
@@ -573,9 +535,6 @@ def __init__(self, baseui, path, create=False):
573
535
if inst .errno != errno .ENOENT :
574
536
raise
575
537
576
- if create :
577
- self ._writerequirements ()
578
- self ._writestorerequirements ()
579
538
if "hgsql" in self .requirements :
580
539
# hgsql wants raw access to revlog. Disable modern features
581
540
# unconditionally for hgsql.
0 commit comments