Mercurial > hg
diff mercurial/localrepo.py @ 39546:41aa5dced975
localrepo: pass ui to newreporequirements() (API)
newreporequirements() is called as part of creating a new repository.
It doesn't make much sense for it to receive a repo instance as part
of determining what requirements for new repos should be.
.. api::
localrepo.newreporequirements() receives a ui instead of a repo
Differential Revision: https://phab.mercurial-scm.org/D4533
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 07 Sep 2018 15:57:55 -0700 |
parents | b66ea3fc3a86 |
children | 7ce9dea3a14a |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Sep 11 15:40:33 2018 -0700 +++ b/mercurial/localrepo.py Fri Sep 07 15:57:55 2018 -0700 @@ -476,7 +476,7 @@ if not self.vfs.isdir(): if create: - self.requirements = newreporequirements(self) + self.requirements = newreporequirements(self.ui) if not self.wvfs.exists(): self.wvfs.makedirs() @@ -2402,13 +2402,12 @@ def islocal(path): return True -def newreporequirements(repo): +def newreporequirements(ui): """Determine the set of requirements for a new local repository. Extensions can wrap this function to specify custom requirements for new repositories. """ - ui = repo.ui requirements = {'revlogv1'} if ui.configbool('format', 'usestore'): requirements.add('store') @@ -2444,7 +2443,7 @@ requirements.discard('generaldelta') requirements.add(REVLOGV2_REQUIREMENT) # experimental config: format.internal-phase - if repo.ui.configbool('format', 'internal-phase'): + if ui.configbool('format', 'internal-phase'): requirements.add('internal-phase') return requirements