Show More
@@ -484,6 +484,25 b' def _getsharedvfs(hgvfs, requirements):' | |||||
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 | |||
@@ -546,17 +565,7 b' def makelocalrepository(baseui, path, in' | |||||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now