##// END OF EJS Templates
localrepo: check for .hg/ directory in makelocalrepository()...
Gregory Szorc -
r39727:2f067e36 default
parent child Browse files
Show More
@@ -397,6 +397,17 def makelocalrepository(baseui, path, in
397 397 hgpath = wdirvfs.join(b'.hg')
398 398 hgvfs = vfsmod.vfs(hgpath, cacheaudited=True)
399 399
400 # The .hg/ path should exist and should be a directory. All other
401 # cases are errors.
402 if not hgvfs.isdir():
403 try:
404 hgvfs.stat()
405 except OSError as e:
406 if e.errno != errno.ENOENT:
407 raise
408
409 raise error.RepoError(_(b'repository %s not found') % path)
410
400 411 # The .hg/hgrc file may load extensions or contain config options
401 412 # that influence repository construction. Attempt to load it and
402 413 # process any new extensions that it may have pulled in.
@@ -503,7 +514,6 class localrepository(object):
503 514 self.vfs = hgvfs
504 515 self.path = hgvfs.base
505 516
506 self.requirements = set()
507 517 self.filtername = None
508 518 # svfs: usually rooted at .hg/store, used to access repository history
509 519 # If this is a shared repository, this vfs may point to another
@@ -535,20 +545,12 class localrepository(object):
535 545 if engine.revlogheader():
536 546 self.supported.add('exp-compression-%s' % name)
537 547
538 if not self.vfs.isdir():
539 548 try:
540 self.vfs.stat()
541 except OSError as inst:
542 if inst.errno != errno.ENOENT:
543 raise
544 raise error.RepoError(_("repository %s not found") % origroot)
545 else:
546 try:
547 self.requirements = scmutil.readrequires(
548 self.vfs, self.supported)
549 self.requirements = scmutil.readrequires(self.vfs, self.supported)
549 550 except IOError as inst:
550 551 if inst.errno != errno.ENOENT:
551 552 raise
553 self.requirements = set()
552 554
553 555 cachepath = self.vfs.join('cache')
554 556 self.sharedpath = self.path
General Comments 0
You need to be logged in to leave comments. Login now