Mercurial > hg-stable
changeset 8315:c8493310ad9b
revlog: use index to find index size
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 07 May 2009 19:39:45 -0500 |
parents | 57a41c08feab |
children | d593922cf480 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Thu May 07 19:39:45 2009 -0500 +++ b/mercurial/revlog.py Thu May 07 19:39:45 2009 -0500 @@ -998,14 +998,9 @@ return text def checkinlinesize(self, tr, fp=None): - if not self._inline: + if not self._inline or (self.start(-2) + self.length(-2)) < 131072: return - if not fp: - fp = self.opener(self.indexfile, 'r') - fp.seek(0, 2) - size = fp.tell() - if size < 131072: - return + trinfo = tr.find(self.indexfile) if trinfo == None: raise RevlogError(_("%s not found in the transaction") @@ -1015,6 +1010,10 @@ dataoff = self.start(trindex) tr.add(self.datafile, dataoff) + + if not fp: + fp = self.opener(self.indexfile, 'r') + df = self.opener(self.datafile, 'w') try: calc = self._io.size