Mercurial > hg
comparison mercurial/upgrade.py @ 39996:dbcb466d0065
localrepo: define storage backend in creation options (API)
We add an experimental config option to define the storage backend
for new repositories. By default, it uses "revlogv1," which maps to
the current and only modern supported repository format.
We add a "backend" creation option to control which backend to
use. It defaults to using the value from the config option.
newreporequirements() will now barf if it sees a "backend" value
that isn't "revlogv1." This forces extensions to monkeypatch the
function to handle requirements derivation for custom backends.
In order for this to "just work," we factored out obtaining the
default creation options into its own function and made callers
of newreporequirements() responsible for passing in valid data.
Without this, direct callers of newreporequirements() wouldn't
get the proper results.
Differential Revision: https://phab.mercurial-scm.org/D4791
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 28 Sep 2018 09:46:50 -0700 |
parents | b399ff55ee6d |
children | 64051af15596 |
comparison
equal
deleted
inserted
replaced
39995:582676acaf6d | 39996:dbcb466d0065 |
---|---|
197 # the requirement that control this format variant | 197 # the requirement that control this format variant |
198 _requirement = None | 198 _requirement = None |
199 | 199 |
200 @staticmethod | 200 @staticmethod |
201 def _newreporequirements(ui): | 201 def _newreporequirements(ui): |
202 return localrepo.newreporequirements(ui) | 202 return localrepo.newreporequirements( |
203 ui, localrepo.defaultcreateopts(ui)) | |
203 | 204 |
204 @classmethod | 205 @classmethod |
205 def fromrepo(cls, repo): | 206 def fromrepo(cls, repo): |
206 assert cls._requirement is not None | 207 assert cls._requirement is not None |
207 return cls._requirement in repo.requirements | 208 return cls._requirement in repo.requirements |
745 'requirement: %s') % | 746 'requirement: %s') % |
746 _(', ').join(sorted(blockedreqs))) | 747 _(', ').join(sorted(blockedreqs))) |
747 | 748 |
748 # FUTURE there is potentially a need to control the wanted requirements via | 749 # FUTURE there is potentially a need to control the wanted requirements via |
749 # command arguments or via an extension hook point. | 750 # command arguments or via an extension hook point. |
750 newreqs = localrepo.newreporequirements(repo.ui) | 751 newreqs = localrepo.newreporequirements( |
752 repo.ui, localrepo.defaultcreateopts(repo.ui)) | |
751 newreqs.update(preservedrequirements(repo)) | 753 newreqs.update(preservedrequirements(repo)) |
752 | 754 |
753 noremovereqs = (repo.requirements - newreqs - | 755 noremovereqs = (repo.requirements - newreqs - |
754 supportremovedrequirements(repo)) | 756 supportremovedrequirements(repo)) |
755 if noremovereqs: | 757 if noremovereqs: |