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) |