comparison mercurial/revlog.py @ 31801:d22f29abeb42

revlog: use raw revision for rawsize When writing the revlog-ng index, the third field is len(rawtext). See revlog._addrevision: textlen = len(rawtext) .... e = (offset_type(offset, flags), l, textlen, base, link, p1r, p2r, node) self.index.insert(-1, e) Therefore, revlog.index[rev][2] returned by revlog.rawsize should be len(rawtext), where "rawtext" is revlog.revision(raw=True). Unfortunately it's hard to add a test for this code path because "if l >= 0" catches most cases.
author Jun Wu <quark@fb.com>
date Sun, 02 Apr 2017 18:57:03 -0700
parents 9ec03d5af48f
children ac9a5e89113a
comparison
equal deleted inserted replaced
31800:c63cb2d10d6d 31801:d22f29abeb42
442 """return the length of the uncompressed text for a given revision""" 442 """return the length of the uncompressed text for a given revision"""
443 l = self.index[rev][2] 443 l = self.index[rev][2]
444 if l >= 0: 444 if l >= 0:
445 return l 445 return l
446 446
447 t = self.revision(rev) 447 t = self.revision(rev, raw=True)
448 return len(t) 448 return len(t)
449 size = rawsize 449 size = rawsize
450 450
451 def chainbase(self, rev): 451 def chainbase(self, rev):
452 base = self._chainbasecache.get(rev) 452 base = self._chainbasecache.get(rev)