Show More
@@ -281,6 +281,9 b' class localrepository(object):' | |||||
281 | self.requirements = requirements |
|
281 | self.requirements = requirements | |
282 | self.sopener.options = dict((r, 1) for r in requirements |
|
282 | self.sopener.options = dict((r, 1) for r in requirements | |
283 | if r in self.openerreqs) |
|
283 | if r in self.openerreqs) | |
|
284 | chunkcachesize = self.ui.configint('format', 'chunkcachesize') | |||
|
285 | if chunkcachesize is not None: | |||
|
286 | self.sopener.options['chunkcachesize'] = chunkcachesize | |||
284 |
|
287 | |||
285 | def _writerequirements(self): |
|
288 | def _writerequirements(self): | |
286 | reqfile = self.opener("requires", "w") |
|
289 | reqfile = self.opener("requires", "w") |
@@ -202,6 +202,7 b' class revlog(object):' | |||||
202 | self._cache = None |
|
202 | self._cache = None | |
203 | self._basecache = None |
|
203 | self._basecache = None | |
204 | self._chunkcache = (0, '') |
|
204 | self._chunkcache = (0, '') | |
|
205 | self._chunkcachesize = 65536 | |||
205 | self.index = [] |
|
206 | self.index = [] | |
206 | self._pcache = {} |
|
207 | self._pcache = {} | |
207 | self._nodecache = {nullid: nullrev} |
|
208 | self._nodecache = {nullid: nullrev} | |
@@ -215,6 +216,15 b' class revlog(object):' | |||||
215 | v |= REVLOGGENERALDELTA |
|
216 | v |= REVLOGGENERALDELTA | |
216 | else: |
|
217 | else: | |
217 | v = 0 |
|
218 | v = 0 | |
|
219 | if 'chunkcachesize' in opts: | |||
|
220 | self._chunkcachesize = opts['chunkcachesize'] | |||
|
221 | ||||
|
222 | if self._chunkcachesize <= 0: | |||
|
223 | raise RevlogError(_('revlog chunk cache size %r is not greater ' | |||
|
224 | 'than 0') % self._chunkcachesize) | |||
|
225 | elif self._chunkcachesize & (self._chunkcachesize - 1): | |||
|
226 | raise RevlogError(_('revlog chunk cache size %r is not a power ' | |||
|
227 | 'of 2') % self._chunkcachesize) | |||
218 |
|
228 | |||
219 | i = '' |
|
229 | i = '' | |
220 | self._initempty = True |
|
230 | self._initempty = True | |
@@ -845,8 +855,10 b' class revlog(object):' | |||||
845 | # Cache data both forward and backward around the requested |
|
855 | # Cache data both forward and backward around the requested | |
846 | # data, in a fixed size window. This helps speed up operations |
|
856 | # data, in a fixed size window. This helps speed up operations | |
847 | # involving reading the revlog backwards. |
|
857 | # involving reading the revlog backwards. | |
848 | realoffset = offset & ~65535 |
|
858 | cachesize = self._chunkcachesize | |
849 | reallength = ((offset + length + 65536) & ~65535) - realoffset |
|
859 | realoffset = offset & ~(cachesize - 1) | |
|
860 | reallength = (((offset + length + cachesize) & ~(cachesize - 1)) | |||
|
861 | - realoffset) | |||
850 | df.seek(realoffset) |
|
862 | df.seek(realoffset) | |
851 | d = df.read(reallength) |
|
863 | d = df.read(reallength) | |
852 | df.close() |
|
864 | df.close() |
@@ -26,6 +26,31 b" creating 'local'" | |||||
26 | $ hg ci --cwd local -A -m "init" |
|
26 | $ hg ci --cwd local -A -m "init" | |
27 | adding foo |
|
27 | adding foo | |
28 |
|
28 | |||
|
29 | test custom revlog chunk cache sizes | |||
|
30 | ||||
|
31 | $ hg --config format.chunkcachesize=0 log -R local -pv | |||
|
32 | abort: revlog chunk cache size 0 is not greater than 0! | |||
|
33 | [255] | |||
|
34 | $ hg --config format.chunkcachesize=1023 log -R local -pv | |||
|
35 | abort: revlog chunk cache size 1023 is not a power of 2! | |||
|
36 | [255] | |||
|
37 | $ hg --config format.chunkcachesize=1024 log -R local -pv | |||
|
38 | changeset: 0:08b9e9f63b32 | |||
|
39 | tag: tip | |||
|
40 | user: test | |||
|
41 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
42 | files: foo | |||
|
43 | description: | |||
|
44 | init | |||
|
45 | ||||
|
46 | ||||
|
47 | diff -r 000000000000 -r 08b9e9f63b32 foo | |||
|
48 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |||
|
49 | +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |||
|
50 | @@ -0,0 +1,1 @@ | |||
|
51 | +this | |||
|
52 | ||||
|
53 | ||||
29 | creating repo with format.usestore=false |
|
54 | creating repo with format.usestore=false | |
30 |
|
55 | |||
31 | $ hg --config format.usestore=false init old |
|
56 | $ hg --config format.usestore=false init old |
General Comments 0
You need to be logged in to leave comments.
Login now