revlog: get rid of defversion
defversion was a property (later option) on the store opener, used to propagate
the changelog revlog format to the other revlogs, so they would be created with
the same format.
This required that the changelog instance was created before any other revlog;
an invariant that wasn't directly enforced (or documented) anywhere.
We now use the revlogv1 requirement instead, which is transfered to the store
opener options. If this option is missing, v0 revlogs are created.
--- a/mercurial/localrepo.py Mon May 16 11:52:28 2011 +0200
+++ b/mercurial/localrepo.py Mon May 16 12:44:34 2011 +0200
@@ -116,9 +116,9 @@
def _applyrequirements(self, requirements):
self.requirements = requirements
- self.sopener.options = {}
- if 'generaldelta' in requirements:
- self.sopener.options['generaldelta'] = 1
+ openerreqs = set(('revlogv1', 'generaldelta'))
+ self.sopener.options = dict((r, 1) for r in requirements
+ if r in openerreqs)
def _writerequirements(self):
reqfile = self.opener("requires", "w")
@@ -178,7 +178,6 @@
p = os.environ['HG_PENDING']
if p.startswith(self.root):
c.readpending('00changelog.i.a')
- self.sopener.options['defversion'] = c.version
return c
@propertycache
--- a/mercurial/revlog.py Mon May 16 11:52:28 2011 +0200
+++ b/mercurial/revlog.py Mon May 16 12:44:34 2011 +0200
@@ -227,12 +227,11 @@
v = REVLOG_DEFAULT_VERSION
if hasattr(opener, 'options'):
- if 'defversion' in opener.options:
- v = opener.options['defversion']
- if v & REVLOGNG:
- v |= REVLOGNGINLINEDATA
- if v & REVLOGNG and 'generaldelta' in opener.options:
- v |= REVLOGGENERALDELTA
+ if 'revlogv1' in opener.options:
+ if 'generaldelta' in opener.options:
+ v |= REVLOGGENERALDELTA
+ else:
+ v = 0
i = ''
try: