equal
deleted
inserted
replaced
482 % sharedvfs.base |
482 % sharedvfs.base |
483 ) |
483 ) |
484 return sharedvfs |
484 return sharedvfs |
485 |
485 |
486 |
486 |
|
487 def _readrequires(vfs, allowmissing): |
|
488 """ reads the require file present at root of this vfs |
|
489 and return a set of requirements |
|
490 |
|
491 If allowmissing is True, we suppress ENOENT if raised""" |
|
492 # requires file contains a newline-delimited list of |
|
493 # features/capabilities the opener (us) must have in order to use |
|
494 # the repository. This file was introduced in Mercurial 0.9.2, |
|
495 # which means very old repositories may not have one. We assume |
|
496 # a missing file translates to no requirements. |
|
497 try: |
|
498 requirements = set(vfs.read(b'requires').splitlines()) |
|
499 except IOError as e: |
|
500 if not (allowmissing and e.errno == errno.ENOENT): |
|
501 raise |
|
502 requirements = set() |
|
503 return requirements |
|
504 |
|
505 |
487 def makelocalrepository(baseui, path, intents=None): |
506 def makelocalrepository(baseui, path, intents=None): |
488 """Create a local repository object. |
507 """Create a local repository object. |
489 |
508 |
490 Given arguments needed to construct a local repository, this function |
509 Given arguments needed to construct a local repository, this function |
491 performs various early repository loading functionality (such as |
510 performs various early repository loading functionality (such as |
544 _(b'invalid path %s: %s') % (path, pycompat.bytestr(e)) |
563 _(b'invalid path %s: %s') % (path, pycompat.bytestr(e)) |
545 ) |
564 ) |
546 |
565 |
547 raise error.RepoError(_(b'repository %s not found') % path) |
566 raise error.RepoError(_(b'repository %s not found') % path) |
548 |
567 |
549 # .hg/requires file contains a newline-delimited list of |
568 requirements = _readrequires(hgvfs, True) |
550 # features/capabilities the opener (us) must have in order to use |
|
551 # the repository. This file was introduced in Mercurial 0.9.2, |
|
552 # which means very old repositories may not have one. We assume |
|
553 # a missing file translates to no requirements. |
|
554 try: |
|
555 requirements = set(hgvfs.read(b'requires').splitlines()) |
|
556 except IOError as e: |
|
557 if e.errno != errno.ENOENT: |
|
558 raise |
|
559 requirements = set() |
|
560 |
569 |
561 # The .hg/hgrc file may load extensions or contain config options |
570 # The .hg/hgrc file may load extensions or contain config options |
562 # that influence repository construction. Attempt to load it and |
571 # that influence repository construction. Attempt to load it and |
563 # process any new extensions that it may have pulled in. |
572 # process any new extensions that it may have pulled in. |
564 if loadhgrc(ui, wdirvfs, hgvfs, requirements): |
573 if loadhgrc(ui, wdirvfs, hgvfs, requirements): |