mercurial/revlog.py
changeset 42804 2eec53a99ec1
parent 42803 1ea668722c0d
child 42805 bf070a59546a
equal deleted inserted replaced
42803:1ea668722c0d 42804:2eec53a99ec1
  1619             rev = None
  1619             rev = None
  1620 
  1620 
  1621         cachedrev = None
  1621         cachedrev = None
  1622         flags = None
  1622         flags = None
  1623         rawtext = None
  1623         rawtext = None
       
  1624         basetext = None
  1624         if node == nullid:
  1625         if node == nullid:
  1625             return ""
  1626             return ""
  1626         if self._revisioncache:
  1627         if self._revisioncache:
  1627             if self._revisioncache[0] == node:
  1628             if self._revisioncache[0] == node:
  1628                 # _cache only stores rawtext
  1629                 # _cache only stores rawtext
  1646             if rev is None:
  1647             if rev is None:
  1647                 rev = self.rev(node)
  1648                 rev = self.rev(node)
  1648 
  1649 
  1649             chain, stopped = self._deltachain(rev, stoprev=cachedrev)
  1650             chain, stopped = self._deltachain(rev, stoprev=cachedrev)
  1650             if stopped:
  1651             if stopped:
  1651                 rawtext = self._revisioncache[2]
  1652                 basetext = self._revisioncache[2]
  1652 
  1653 
  1653             # drop cache to save memory
  1654             # drop cache to save memory
  1654             self._revisioncache = None
  1655             self._revisioncache = None
  1655 
  1656 
  1656             targetsize = None
  1657             targetsize = None
  1657             rawsize = self.index[rev][2]
  1658             rawsize = self.index[rev][2]
  1658             if 0 <= rawsize:
  1659             if 0 <= rawsize:
  1659                 targetsize = 4 * rawsize
  1660                 targetsize = 4 * rawsize
  1660 
  1661 
  1661             bins = self._chunks(chain, df=_df, targetsize=targetsize)
  1662             bins = self._chunks(chain, df=_df, targetsize=targetsize)
  1662             if rawtext is None:
  1663             if basetext is None:
  1663                 rawtext = bytes(bins[0])
  1664                 basetext = bytes(bins[0])
  1664                 bins = bins[1:]
  1665                 bins = bins[1:]
  1665 
  1666 
  1666             rawtext = mdiff.patches(rawtext, bins)
  1667             rawtext = mdiff.patches(basetext, bins)
       
  1668             del basetext # let us have a chance to free memory early
  1667             self._revisioncache = (node, rev, rawtext)
  1669             self._revisioncache = (node, rev, rawtext)
  1668 
  1670 
  1669         if flags is None:
  1671         if flags is None:
  1670             if rev is None:
  1672             if rev is None:
  1671                 rev = self.rev(node)
  1673                 rev = self.rev(node)