mercurial/revlog.py
changeset 8315 c8493310ad9b
parent 8314 57a41c08feab
child 8316 d593922cf480
equal deleted inserted replaced
8314:57a41c08feab 8315:c8493310ad9b
   996 
   996 
   997         self._cache = (node, rev, text)
   997         self._cache = (node, rev, text)
   998         return text
   998         return text
   999 
   999 
  1000     def checkinlinesize(self, tr, fp=None):
  1000     def checkinlinesize(self, tr, fp=None):
  1001         if not self._inline:
  1001         if not self._inline or (self.start(-2) + self.length(-2)) < 131072:
  1002             return
  1002             return
  1003         if not fp:
  1003 
  1004             fp = self.opener(self.indexfile, 'r')
       
  1005             fp.seek(0, 2)
       
  1006         size = fp.tell()
       
  1007         if size < 131072:
       
  1008             return
       
  1009         trinfo = tr.find(self.indexfile)
  1004         trinfo = tr.find(self.indexfile)
  1010         if trinfo == None:
  1005         if trinfo == None:
  1011             raise RevlogError(_("%s not found in the transaction")
  1006             raise RevlogError(_("%s not found in the transaction")
  1012                               % self.indexfile)
  1007                               % self.indexfile)
  1013 
  1008 
  1014         trindex = trinfo[2]
  1009         trindex = trinfo[2]
  1015         dataoff = self.start(trindex)
  1010         dataoff = self.start(trindex)
  1016 
  1011 
  1017         tr.add(self.datafile, dataoff)
  1012         tr.add(self.datafile, dataoff)
       
  1013 
       
  1014         if not fp:
       
  1015             fp = self.opener(self.indexfile, 'r')
       
  1016 
  1018         df = self.opener(self.datafile, 'w')
  1017         df = self.opener(self.datafile, 'w')
  1019         try:
  1018         try:
  1020             calc = self._io.size
  1019             calc = self._io.size
  1021             for r in self:
  1020             for r in self:
  1022                 start = self.start(r) + (r + 1) * calc
  1021                 start = self.start(r) + (r + 1) * calc