Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 39712:9de1a1c83cd7
localrepo: document and test bug around opening shared repos
As part of refactoring this code, I realized that we don't
validate the requirements of a shared repository. This commit
documents that next to the requirements validation code and adds a
test demonstrating the buggy behavior.
I'm not sure if I'll fix this. But it is definitely a bug that
users could encounter, as LFS, narrow, and potentially other
extensions dynamically add requirements on first use. One part
of this I'm not sure about is how to handle loading the .hg/hgrc
of the shared repo. We need to do that in order to load extensions.
But we don't want that repo's hgrc to overwrite the current repo's.
Differential Revision: https://phab.mercurial-scm.org/D4572
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 12 Sep 2018 13:10:45 -0700 |
parents | cb2dcfa5cade |
children | 98ca9078807a |
comparison
equal
deleted
inserted
replaced
39711:cb2dcfa5cade | 39712:9de1a1c83cd7 |
---|---|
435 # We first validate the requirements are known. | 435 # We first validate the requirements are known. |
436 ensurerequirementsrecognized(requirements, supportedrequirements) | 436 ensurerequirementsrecognized(requirements, supportedrequirements) |
437 | 437 |
438 # Then we validate that the known set is reasonable to use together. | 438 # Then we validate that the known set is reasonable to use together. |
439 ensurerequirementscompatible(ui, requirements) | 439 ensurerequirementscompatible(ui, requirements) |
440 | |
441 # TODO there are unhandled edge cases related to opening repositories with | |
442 # shared storage. If storage is shared, we should also test for requirements | |
443 # compatibility in the pointed-to repo. This entails loading the .hg/hgrc in | |
444 # that repo, as that repo may load extensions needed to open it. This is a | |
445 # bit complicated because we don't want the other hgrc to overwrite settings | |
446 # in this hgrc. | |
447 # | |
448 # This bug is somewhat mitigated by the fact that we copy the .hg/requires | |
449 # file when sharing repos. But if a requirement is added after the share is | |
450 # performed, thereby introducing a new requirement for the opener, we may | |
451 # will not see that and could encounter a run-time error interacting with | |
452 # that shared store since it has an unknown-to-us requirement. | |
440 | 453 |
441 # At this point, we know we should be capable of opening the repository. | 454 # At this point, we know we should be capable of opening the repository. |
442 # Now get on with doing that. | 455 # Now get on with doing that. |
443 | 456 |
444 return localrepository( | 457 return localrepository( |