##// 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 b' def makelocalrepository(baseui, path, in'
397 hgpath = wdirvfs.join(b'.hg')
397 hgpath = wdirvfs.join(b'.hg')
398 hgvfs = vfsmod.vfs(hgpath, cacheaudited=True)
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 # The .hg/hgrc file may load extensions or contain config options
411 # The .hg/hgrc file may load extensions or contain config options
401 # that influence repository construction. Attempt to load it and
412 # that influence repository construction. Attempt to load it and
402 # process any new extensions that it may have pulled in.
413 # process any new extensions that it may have pulled in.
@@ -503,7 +514,6 b' class localrepository(object):'
503 self.vfs = hgvfs
514 self.vfs = hgvfs
504 self.path = hgvfs.base
515 self.path = hgvfs.base
505
516
506 self.requirements = set()
507 self.filtername = None
517 self.filtername = None
508 # svfs: usually rooted at .hg/store, used to access repository history
518 # svfs: usually rooted at .hg/store, used to access repository history
509 # If this is a shared repository, this vfs may point to another
519 # If this is a shared repository, this vfs may point to another
@@ -535,20 +545,12 b' class localrepository(object):'
535 if engine.revlogheader():
545 if engine.revlogheader():
536 self.supported.add('exp-compression-%s' % name)
546 self.supported.add('exp-compression-%s' % name)
537
547
538 if not self.vfs.isdir():
548 try:
539 try:
549 self.requirements = scmutil.readrequires(self.vfs, self.supported)
540 self.vfs.stat()
550 except IOError as inst:
541 except OSError as inst:
551 if inst.errno != errno.ENOENT:
542 if inst.errno != errno.ENOENT:
552 raise
543 raise
553 self.requirements = set()
544 raise error.RepoError(_("repository %s not found") % origroot)
545 else:
546 try:
547 self.requirements = scmutil.readrequires(
548 self.vfs, self.supported)
549 except IOError as inst:
550 if inst.errno != errno.ENOENT:
551 raise
552
554
553 cachepath = self.vfs.join('cache')
555 cachepath = self.vfs.join('cache')
554 self.sharedpath = self.path
556 self.sharedpath = self.path
General Comments 0
You need to be logged in to leave comments. Login now