# HG changeset patch # User Matt Mackall # Date 1185241448 18000 # Node ID 9672e3c42b0c367cd01c027ff804316288fd8738 # Parent e7131935fbb331854011ebf30f0f563eb86ff3b0 revlog: change _inline from a function to a variable diff -r e7131935fbb3 -r 9672e3c42b0c mercurial/revlog.py --- a/mercurial/revlog.py Mon Jul 23 20:44:08 2007 -0500 +++ b/mercurial/revlog.py Mon Jul 23 20:44:08 2007 -0500 @@ -460,13 +460,14 @@ raise RevlogError(_("index %s unknown format %d") % (self.indexfile, fmt)) self.version = v + self._inline = v & REVLOGNGINLINEDATA self.nodemap = {nullid: nullrev} self.index = [] self._io = revlogio() if self.version == REVLOGV0: self._io = revlogoldio() if i: - self.index, self.nodemap = self._io.parseindex(f, st, self._inline()) + self.index, self.nodemap = self._io.parseindex(f, st, self._inline) # add the magic null revision at -1 self.index.append((0, 0, 0, -1, -1, -1, -1, nullid)) @@ -488,8 +489,6 @@ self.nodemap.p.loadmap() self.nodemap = self.nodemap.p.map - def _inline(self): - return self.version & REVLOGNGINLINEDATA def tip(self): return self.node(len(self.index) - 2) def count(self): @@ -844,7 +843,7 @@ def chunk(self, rev, df=None, cachelen=4096): start, length = self.start(rev), self.length(rev) - inline = self._inline() + inline = self._inline if inline: start += (rev + 1) * self._io.size end = start + length @@ -899,7 +898,7 @@ rev = self.rev(node) base = self.base(rev) - if self._inline(): + if self._inline: # we probably have the whole chunk cached df = None else: @@ -929,7 +928,7 @@ return text def checkinlinesize(self, tr, fp=None): - if not self._inline(): + if not self._inline: return if not fp: fp = self.opener(self.indexfile, 'r') @@ -958,6 +957,7 @@ df.close() fp = self.opener(self.indexfile, 'w', atomictemp=True) self.version &= ~(REVLOGNGINLINEDATA) + self._inline = False if self.count(): x = self.index[0] e = struct.pack(indexformatng, *x)[4:] @@ -987,7 +987,7 @@ d - an optional precomputed delta """ dfh = None - if not self._inline(): + if not self._inline: dfh = self.opener(self.datafile, "a") ifh = self.opener(self.indexfile, "a+") return self._addrevision(text, transaction, link, p1, p2, d, ifh, dfh) @@ -1030,7 +1030,7 @@ if not curr: entry = struct.pack(versionformat, self.version) + entry[4:] - if not self._inline(): + if not self._inline: transaction.add(self.datafile, offset) transaction.add(self.indexfile, curr * len(entry)) if data[0]: @@ -1118,7 +1118,7 @@ ifh = self.opener(self.indexfile, "a+") ifh.seek(0, 2) transaction.add(self.indexfile, ifh.tell(), self.count()) - if self._inline(): + if self._inline: dfh = None else: transaction.add(self.datafile, end) @@ -1167,7 +1167,7 @@ text = self.patches(text, [delta]) chk = self._addrevision(text, transaction, link, p1, p2, None, ifh, dfh) - if not dfh and not self._inline(): + if not dfh and not self._inline: # addrevision switched from inline to conventional # reopen the index dfh = self.opener(self.datafile, "a") @@ -1180,11 +1180,11 @@ link, self.rev(p1), self.rev(p2), node) self.index.insert(-1, e) self.nodemap[node] = r - if self._inline(): + if self._inline: ifh.write(struct.pack(indexformatng, *e)) ifh.write(cdelta) self.checkinlinesize(transaction, ifh) - if not self._inline(): + if not self._inline: dfh = self.opener(self.datafile, "a") ifh = self.opener(self.indexfile, "a") else: @@ -1221,7 +1221,7 @@ # first truncate the files on disk end = self.start(rev) - if not self._inline(): + if not self._inline: df = self.opener(self.datafile, "a") df.truncate(end) end = rev * self._io.size @@ -1261,7 +1261,7 @@ s = self._io.size i = actual / s di = actual - (i * s) - if self._inline(): + if self._inline: databytes = 0 for r in xrange(self.count()): databytes += self.length(r)