Mercurial > hg-stable
changeset 17137:b090601a80d1
localrepo: make requirements and openerreqs mutable by subclasses
This is necessary for extensions that need to modify a repo's
requirements.
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Wed, 11 Jul 2012 15:36:00 -0700 |
parents | de8173d0c326 |
children | 528cb91a90ee |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Jul 11 15:34:01 2012 -0700 +++ b/mercurial/localrepo.py Wed Jul 11 15:36:00 2012 -0700 @@ -29,6 +29,11 @@ supportedformats = set(('revlogv1', 'generaldelta')) supported = supportedformats | set(('store', 'fncache', 'shared', 'dotencode')) + openerreqs = set(('revlogv1', 'generaldelta')) + requirements = ['revlogv1'] + + def _baserequirements(self, create): + return self.requirements[:] def __init__(self, baseui, path=None, create=False): repo.repository.__init__(self) @@ -56,7 +61,7 @@ if not os.path.exists(path): util.makedirs(path) util.makedir(self.path, notindexed=True) - requirements = ["revlogv1"] + requirements = self._baserequirements(create) if self.ui.configbool('format', 'usestore', True): os.mkdir(os.path.join(self.path, "store")) requirements.append("store") @@ -120,9 +125,8 @@ def _applyrequirements(self, requirements): self.requirements = requirements - openerreqs = set(('revlogv1', 'generaldelta')) self.sopener.options = dict((r, 1) for r in requirements - if r in openerreqs) + if r in self.openerreqs) def _writerequirements(self): reqfile = self.opener("requires", "w")