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