comparison mercurial/revlog.py @ 10913:f2ecc5733c89 stable

revlog: factor out _maxinline global. This lets us change the threshold at which a *.d file will be split out, which should make it much easier to construct test cases that probe revlogs with a separate data file. (issue2137)
author Greg Ward <greg-hg@gerg.ca>
date Tue, 13 Apr 2010 17:58:38 -0400
parents 3e7cbe859871
children b7ca37b90762
comparison
equal deleted inserted replaced
10909:29a83fb8c067 10913:f2ecc5733c89
30 REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA 30 REVLOG_DEFAULT_FLAGS = REVLOGNGINLINEDATA
31 REVLOG_DEFAULT_FORMAT = REVLOGNG 31 REVLOG_DEFAULT_FORMAT = REVLOGNG
32 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS 32 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
33 33
34 _prereadsize = 1048576 34 _prereadsize = 1048576
35
36 _maxinline = 131072 # max size of revlog with inline data
35 37
36 RevlogError = error.RevlogError 38 RevlogError = error.RevlogError
37 LookupError = error.LookupError 39 LookupError = error.LookupError
38 40
39 def getoffset(q): 41 def getoffset(q):
1008 1010
1009 self._cache = (node, rev, text) 1011 self._cache = (node, rev, text)
1010 return text 1012 return text
1011 1013
1012 def checkinlinesize(self, tr, fp=None): 1014 def checkinlinesize(self, tr, fp=None):
1013 if not self._inline or (self.start(-2) + self.length(-2)) < 131072: 1015 if not self._inline or (self.start(-2) + self.length(-2)) < _maxinline:
1014 return 1016 return
1015 1017
1016 trinfo = tr.find(self.indexfile) 1018 trinfo = tr.find(self.indexfile)
1017 if trinfo is None: 1019 if trinfo is None:
1018 raise RevlogError(_("%s not found in the transaction") 1020 raise RevlogError(_("%s not found in the transaction")