Show More
@@ -316,6 +316,9 b' class localrepository(object):' | |||||
316 | chunkcachesize = self.ui.configint('format', 'chunkcachesize') |
|
316 | chunkcachesize = self.ui.configint('format', 'chunkcachesize') | |
317 | if chunkcachesize is not None: |
|
317 | if chunkcachesize is not None: | |
318 | self.sopener.options['chunkcachesize'] = chunkcachesize |
|
318 | self.sopener.options['chunkcachesize'] = chunkcachesize | |
|
319 | maxchainlen = self.ui.configint('revlog', 'maxchainlen') | |||
|
320 | if maxchainlen is not None: | |||
|
321 | self.sopener.options['maxchainlen'] = maxchainlen | |||
319 |
|
322 | |||
320 | def _writerequirements(self): |
|
323 | def _writerequirements(self): | |
321 | reqfile = self.opener("requires", "w") |
|
324 | reqfile = self.opener("requires", "w") |
@@ -204,6 +204,7 b' class revlog(object):' | |||||
204 | self._basecache = None |
|
204 | self._basecache = None | |
205 | self._chunkcache = (0, '') |
|
205 | self._chunkcache = (0, '') | |
206 | self._chunkcachesize = 65536 |
|
206 | self._chunkcachesize = 65536 | |
|
207 | self._maxchainlen = None | |||
207 | self.index = [] |
|
208 | self.index = [] | |
208 | self._pcache = {} |
|
209 | self._pcache = {} | |
209 | self._nodecache = {nullid: nullrev} |
|
210 | self._nodecache = {nullid: nullrev} | |
@@ -219,6 +220,8 b' class revlog(object):' | |||||
219 | v = 0 |
|
220 | v = 0 | |
220 | if 'chunkcachesize' in opts: |
|
221 | if 'chunkcachesize' in opts: | |
221 | self._chunkcachesize = opts['chunkcachesize'] |
|
222 | self._chunkcachesize = opts['chunkcachesize'] | |
|
223 | if 'maxchainlen' in opts: | |||
|
224 | self._maxchainlen = opts['maxchainlen'] | |||
222 |
|
225 | |||
223 | if self._chunkcachesize <= 0: |
|
226 | if self._chunkcachesize <= 0: | |
224 | raise RevlogError(_('revlog chunk cache size %r is not greater ' |
|
227 | raise RevlogError(_('revlog chunk cache size %r is not greater ' | |
@@ -1216,11 +1219,13 b' class revlog(object):' | |||||
1216 | base = rev |
|
1219 | base = rev | |
1217 | else: |
|
1220 | else: | |
1218 | base = chainbase |
|
1221 | base = chainbase | |
1219 | return dist, l, data, base, chainbase |
|
1222 | chainlen = self.chainlen(rev) + 1 | |
|
1223 | return dist, l, data, base, chainbase, chainlen | |||
1220 |
|
1224 | |||
1221 | curr = len(self) |
|
1225 | curr = len(self) | |
1222 | prev = curr - 1 |
|
1226 | prev = curr - 1 | |
1223 | base = chainbase = curr |
|
1227 | base = chainbase = curr | |
|
1228 | chainlen = None | |||
1224 | offset = self.end(prev) |
|
1229 | offset = self.end(prev) | |
1225 | flags = 0 |
|
1230 | flags = 0 | |
1226 | d = None |
|
1231 | d = None | |
@@ -1240,7 +1245,7 b' class revlog(object):' | |||||
1240 | d = builddelta(prev) |
|
1245 | d = builddelta(prev) | |
1241 | else: |
|
1246 | else: | |
1242 | d = builddelta(prev) |
|
1247 | d = builddelta(prev) | |
1243 | dist, l, data, base, chainbase = d |
|
1248 | dist, l, data, base, chainbase, chainlen = d | |
1244 |
|
1249 | |||
1245 | # full versions are inserted when the needed deltas |
|
1250 | # full versions are inserted when the needed deltas | |
1246 | # become comparable to the uncompressed text |
|
1251 | # become comparable to the uncompressed text | |
@@ -1249,7 +1254,8 b' class revlog(object):' | |||||
1249 | cachedelta[1]) |
|
1254 | cachedelta[1]) | |
1250 | else: |
|
1255 | else: | |
1251 | textlen = len(text) |
|
1256 | textlen = len(text) | |
1252 |
if d is None or dist > textlen * 2 |
|
1257 | if (d is None or dist > textlen * 2 or | |
|
1258 | self._maxchainlen and chainlen > self._maxchainlen): | |||
1253 | text = buildtext() |
|
1259 | text = buildtext() | |
1254 | data = self.compress(text) |
|
1260 | data = self.compress(text) | |
1255 | l = len(data[1]) + len(data[0]) |
|
1261 | l = len(data[1]) + len(data[0]) |
@@ -24,6 +24,40 b'' | |||||
24 | full revision size (min/max/avg) : 44 / 44 / 44 |
|
24 | full revision size (min/max/avg) : 44 / 44 / 44 | |
25 | delta size (min/max/avg) : 0 / 0 / 0 |
|
25 | delta size (min/max/avg) : 0 / 0 / 0 | |
26 |
|
26 | |||
|
27 | Test max chain len | |||
|
28 | $ cat >> $HGRCPATH << EOF | |||
|
29 | > [revlog] | |||
|
30 | > maxchainlen=4 | |||
|
31 | > EOF | |||
|
32 | ||||
|
33 | $ echo "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a | |||
|
34 | $ hg ci -m a | |||
|
35 | $ echo "b\n" >> a | |||
|
36 | $ hg ci -m a | |||
|
37 | $ echo "c\n" >> a | |||
|
38 | $ hg ci -m a | |||
|
39 | $ echo "d\n" >> a | |||
|
40 | $ hg ci -m a | |||
|
41 | $ echo "e\n" >> a | |||
|
42 | $ hg ci -m a | |||
|
43 | $ echo "f\n" >> a | |||
|
44 | $ hg ci -m a | |||
|
45 | $ echo 'g\n' >> a | |||
|
46 | $ hg ci -m a | |||
|
47 | $ echo 'h\n' >> a | |||
|
48 | $ hg ci -m a | |||
|
49 | $ hg debugrevlog -d a | |||
|
50 | # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen | |||
|
51 | 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob) | |||
|
52 | 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob) | |||
|
53 | 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob) | |||
|
54 | 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob) | |||
|
55 | 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob) | |||
|
56 | 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob) | |||
|
57 | 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob) | |||
|
58 | 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob) | |||
|
59 | 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob) | |||
|
60 | $ cd .. | |||
27 |
|
61 | |||
28 | Test internal debugstacktrace command |
|
62 | Test internal debugstacktrace command | |
29 |
|
63 |
General Comments 0
You need to be logged in to leave comments.
Login now