##// END OF EJS Templates
revlog: support writing generaldelta revlogs...
Sune Foldager -
r14270:d6907a56 default
parent child Browse files
Show More
@@ -21,7 +21,7 b' propertycache = util.propertycache'
21 class localrepository(repo.repository):
21 class localrepository(repo.repository):
22 capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey',
22 capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey',
23 'known', 'getbundle'))
23 'known', 'getbundle'))
24 supportedformats = set(('revlogv1',))
24 supportedformats = set(('revlogv1', 'generaldelta'))
25 supported = supportedformats | set(('store', 'fncache', 'shared',
25 supported = supportedformats | set(('store', 'fncache', 'shared',
26 'dotencode'))
26 'dotencode'))
27
27
@@ -61,6 +61,8 b' class localrepository(repo.repository):'
61 '\0\0\0\2' # represents revlogv2
61 '\0\0\0\2' # represents revlogv2
62 ' dummy changelog to prevent using the old repo layout'
62 ' dummy changelog to prevent using the old repo layout'
63 )
63 )
64 if self.ui.configbool('format', 'generaldelta', False):
65 requirements.append("generaldelta")
64 else:
66 else:
65 raise error.RepoError(_("repository %s not found") % path)
67 raise error.RepoError(_("repository %s not found") % path)
66 elif create:
68 elif create:
@@ -115,6 +117,8 b' class localrepository(repo.repository):'
115 def _applyrequirements(self, requirements):
117 def _applyrequirements(self, requirements):
116 self.requirements = requirements
118 self.requirements = requirements
117 self.sopener.options = {}
119 self.sopener.options = {}
120 if 'generaldelta' in requirements:
121 self.sopener.options['generaldelta'] = 1
118
122
119 def _writerequirements(self):
123 def _writerequirements(self):
120 reqfile = self.opener("requires", "w")
124 reqfile = self.opener("requires", "w")
@@ -226,10 +226,13 b' class revlog(object):'
226 self._nodepos = None
226 self._nodepos = None
227
227
228 v = REVLOG_DEFAULT_VERSION
228 v = REVLOG_DEFAULT_VERSION
229 if hasattr(opener, 'options') and 'defversion' in opener.options:
229 if hasattr(opener, 'options'):
230 if 'defversion' in opener.options:
230 v = opener.options['defversion']
231 v = opener.options['defversion']
231 if v & REVLOGNG:
232 if v & REVLOGNG:
232 v |= REVLOGNGINLINEDATA
233 v |= REVLOGNGINLINEDATA
234 if v & REVLOGNG and 'generaldelta' in opener.options:
235 v |= REVLOGGENERALDELTA
233
236
234 i = ''
237 i = ''
235 try:
238 try:
@@ -1003,10 +1006,14 b' class revlog(object):'
1003 l = len(data[1]) + len(data[0])
1006 l = len(data[1]) + len(data[0])
1004 basecache = self._basecache
1007 basecache = self._basecache
1005 if basecache and basecache[0] == rev:
1008 if basecache and basecache[0] == rev:
1006 base = basecache[1]
1009 chainbase = basecache[1]
1007 else:
1010 else:
1008 base = self.chainbase(rev)
1011 chainbase = self.chainbase(rev)
1009 dist = l + offset - self.start(base)
1012 dist = l + offset - self.start(chainbase)
1013 if self._generaldelta:
1014 base = rev
1015 else:
1016 base = chainbase
1010 return dist, l, data, base
1017 return dist, l, data, base
1011
1018
1012 curr = len(self)
1019 curr = len(self)
@@ -1019,6 +1026,9 b' class revlog(object):'
1019
1026
1020 # should we try to build a delta?
1027 # should we try to build a delta?
1021 if prev != nullrev:
1028 if prev != nullrev:
1029 if self._generaldelta:
1030 d = builddelta(p1r)
1031 else:
1022 d = builddelta(prev)
1032 d = builddelta(prev)
1023 dist, l, data, base = d
1033 dist, l, data, base = d
1024
1034
General Comments 0
You need to be logged in to leave comments. Login now