##// END OF EJS Templates
revlog: make _addrevision only accept rawtext...
Jun Wu -
r31755:ec48d57d default
parent child Browse files
Show More
@@ -1577,19 +1577,19 b' class revlog(object):'
1577
1577
1578 return True
1578 return True
1579
1579
1580 def _addrevision(self, node, text, transaction, link, p1, p2, flags,
1580 def _addrevision(self, node, rawtext, transaction, link, p1, p2, flags,
1581 cachedelta, ifh, dfh, alwayscache=False, raw=False):
1581 cachedelta, ifh, dfh, alwayscache=False):
1582 """internal function to add revisions to the log
1582 """internal function to add revisions to the log
1583
1583
1584 see addrevision for argument descriptions.
1584 see addrevision for argument descriptions.
1585
1586 note: "addrevision" takes non-raw text, "_addrevision" takes raw text.
1587
1585 invariants:
1588 invariants:
1586 - text is optional (can be None); if not set, cachedelta must be set.
1589 - rawtext is optional (can be None); if not set, cachedelta must be set.
1587 if both are set, they must correspond to each other.
1590 if both are set, they must correspond to each other.
1588 - raw is optional; if set to True, it indicates the revision data is to
1589 be treated by _processflags() as raw. It is usually set by changegroup
1590 generation and debug commands.
1591 """
1591 """
1592 btext = [text]
1592 btext = [rawtext]
1593 def buildtext():
1593 def buildtext():
1594 if btext[0] is not None:
1594 if btext[0] is not None:
1595 return btext[0]
1595 return btext[0]
@@ -1607,11 +1607,11 b' class revlog(object):'
1607 fh = ifh
1607 fh = ifh
1608 else:
1608 else:
1609 fh = dfh
1609 fh = dfh
1610 basetext = self.revision(baserev, _df=fh, raw=raw)
1610 basetext = self.revision(baserev, _df=fh, raw=True)
1611 btext[0] = mdiff.patch(basetext, delta)
1611 btext[0] = mdiff.patch(basetext, delta)
1612
1612
1613 try:
1613 try:
1614 res = self._processflags(btext[0], flags, 'read', raw=raw)
1614 res = self._processflags(btext[0], flags, 'read', raw=True)
1615 btext[0], validatehash = res
1615 btext[0], validatehash = res
1616 if validatehash:
1616 if validatehash:
1617 self.checkhash(btext[0], node, p1=p1, p2=p2)
1617 self.checkhash(btext[0], node, p1=p1, p2=p2)
@@ -1663,11 +1663,11 b' class revlog(object):'
1663
1663
1664 # full versions are inserted when the needed deltas
1664 # full versions are inserted when the needed deltas
1665 # become comparable to the uncompressed text
1665 # become comparable to the uncompressed text
1666 if text is None:
1666 if rawtext is None:
1667 textlen = mdiff.patchedsize(self.rawsize(cachedelta[0]),
1667 textlen = mdiff.patchedsize(self.rawsize(cachedelta[0]),
1668 cachedelta[1])
1668 cachedelta[1])
1669 else:
1669 else:
1670 textlen = len(text)
1670 textlen = len(rawtext)
1671
1671
1672 # should we try to build a delta?
1672 # should we try to build a delta?
1673 if prev != nullrev and self.storedeltachains:
1673 if prev != nullrev and self.storedeltachains:
@@ -1708,8 +1708,8 b' class revlog(object):'
1708 if delta is not None:
1708 if delta is not None:
1709 dist, l, data, base, chainbase, chainlen, compresseddeltalen = delta
1709 dist, l, data, base, chainbase, chainlen, compresseddeltalen = delta
1710 else:
1710 else:
1711 text = buildtext()
1711 rawtext = buildtext()
1712 data = self.compress(text)
1712 data = self.compress(rawtext)
1713 l = len(data[1]) + len(data[0])
1713 l = len(data[1]) + len(data[0])
1714 base = chainbase = curr
1714 base = chainbase = curr
1715
1715
@@ -1721,11 +1721,11 b' class revlog(object):'
1721 entry = self._io.packentry(e, self.node, self.version, curr)
1721 entry = self._io.packentry(e, self.node, self.version, curr)
1722 self._writeentry(transaction, ifh, dfh, entry, data, link, offset)
1722 self._writeentry(transaction, ifh, dfh, entry, data, link, offset)
1723
1723
1724 if alwayscache and text is None:
1724 if alwayscache and rawtext is None:
1725 text = buildtext()
1725 rawtext = buildtext()
1726
1726
1727 if type(text) == str: # only accept immutable objects
1727 if type(rawtext) == str: # only accept immutable objects
1728 self._cache = (node, curr, text)
1728 self._cache = (node, curr, rawtext)
1729 self._chainbasecache[curr] = chainbase
1729 self._chainbasecache[curr] = chainbase
1730 return node
1730 return node
1731
1731
@@ -1847,8 +1847,7 b' class revlog(object):'
1847 chain = self._addrevision(node, None, transaction, link,
1847 chain = self._addrevision(node, None, transaction, link,
1848 p1, p2, flags, (baserev, delta),
1848 p1, p2, flags, (baserev, delta),
1849 ifh, dfh,
1849 ifh, dfh,
1850 alwayscache=bool(addrevisioncb),
1850 alwayscache=bool(addrevisioncb))
1851 raw=True)
1852
1851
1853 if addrevisioncb:
1852 if addrevisioncb:
1854 addrevisioncb(self, chain)
1853 addrevisioncb(self, chain)
@@ -1,4 +1,4 b''
1 local test passed
1 local test passed
2 addgroupcopy test passed
2 addgroupcopy test passed
3 clone test passed
3 clone test passed
4 abort: crashed: integrity check failed on _destrevlog.i:5
4 lowlevelcopy test passed
General Comments 0
You need to be logged in to leave comments. Login now