Show More
@@ -431,8 +431,13 b' def makelocalrepository(baseui, path, in' | |||
|
431 | 431 | extensions.loadall(ui) |
|
432 | 432 | |
|
433 | 433 | supportedrequirements = gathersupportedrequirements(ui) |
|
434 | ||
|
435 | # We first validate the requirements are known. | |
|
434 | 436 | ensurerequirementsrecognized(requirements, supportedrequirements) |
|
435 | 437 | |
|
438 | # Then we validate that the known set is reasonable to use together. | |
|
439 | ensurerequirementscompatible(ui, requirements) | |
|
440 | ||
|
436 | 441 | # At this point, we know we should be capable of opening the repository. |
|
437 | 442 | # Now get on with doing that. |
|
438 | 443 | |
@@ -494,6 +499,24 b' def ensurerequirementsrecognized(require' | |||
|
494 | 499 | hint=_(b'see https://mercurial-scm.org/wiki/MissingRequirement ' |
|
495 | 500 | b'for more information')) |
|
496 | 501 | |
|
502 | def ensurerequirementscompatible(ui, requirements): | |
|
503 | """Validates that a set of recognized requirements is mutually compatible. | |
|
504 | ||
|
505 | Some requirements may not be compatible with others or require | |
|
506 | config options that aren't enabled. This function is called during | |
|
507 | repository opening to ensure that the set of requirements needed | |
|
508 | to open a repository is sane and compatible with config options. | |
|
509 | ||
|
510 | Extensions can monkeypatch this function to perform additional | |
|
511 | checking. | |
|
512 | ||
|
513 | ``error.RepoError`` should be raised on failure. | |
|
514 | """ | |
|
515 | if b'exp-sparse' in requirements and not sparse.enabled: | |
|
516 | raise error.RepoError(_(b'repository is using sparse feature but ' | |
|
517 | b'sparse is not enabled; enable the ' | |
|
518 | b'"sparse" extensions to access')) | |
|
519 | ||
|
497 | 520 | @interfaceutil.implementer(repository.completelocalrepository) |
|
498 | 521 | class localrepository(object): |
|
499 | 522 | |
@@ -625,11 +648,6 b' class localrepository(object):' | |||
|
625 | 648 | if inst.errno != errno.ENOENT: |
|
626 | 649 | raise |
|
627 | 650 | |
|
628 | if 'exp-sparse' in self.requirements and not sparse.enabled: | |
|
629 | raise error.RepoError(_('repository is using sparse feature but ' | |
|
630 | 'sparse is not enabled; enable the ' | |
|
631 | '"sparse" extensions to access')) | |
|
632 | ||
|
633 | 651 | self.store = store.store( |
|
634 | 652 | self.requirements, self.sharedpath, |
|
635 | 653 | lambda base: vfsmod.vfs(base, cacheaudited=True)) |
@@ -176,6 +176,7 b' class statichttprepository(localrepo.loc' | |||
|
176 | 176 | supportedrequirements = localrepo.gathersupportedrequirements(ui) |
|
177 | 177 | localrepo.ensurerequirementsrecognized(requirements, |
|
178 | 178 | supportedrequirements) |
|
179 | localrepo.ensurerequirementscompatible(ui, requirements) | |
|
179 | 180 | |
|
180 | 181 | # setup store |
|
181 | 182 | self.store = store.store(requirements, self.path, vfsclass) |
General Comments 0
You need to be logged in to leave comments.
Login now