##// END OF EJS Templates
manifest: introduce new exception to signal unavailability of fastdelta()...
Augie Fackler -
r45154:948fac24 default
parent child Browse files
Show More
@@ -1052,6 +1052,9 b' class imanifestdict(interfaceutil.Interf'
1052 1052
1053 1053 Returns a 2-tuple containing ``bytearray(self.text())`` and the
1054 1054 delta between ``base`` and this manifest.
1055
1056 If this manifest implementation can't support ``fastdelta()``,
1057 raise ``mercurial.manifest.FastdeltaUnavailable``.
1055 1058 """
1056 1059
1057 1060
@@ -1212,6 +1212,9 b' class treemanifest(object):'
1212 1212 ret._dirty = True
1213 1213 return ret
1214 1214
1215 def fastdelta(self, base, changes):
1216 raise FastdeltaUnavailable()
1217
1215 1218 def diff(self, m2, match=None, clean=False):
1216 1219 '''Finds changes between the current manifest and m2.
1217 1220
@@ -1488,6 +1491,10 b' class manifestfulltextcache(util.lrucach'
1488 1491 MAXCOMPRESSION = 3
1489 1492
1490 1493
1494 class FastdeltaUnavailable(Exception):
1495 """Exception raised when fastdelta isn't usable on a manifest."""
1496
1497
1491 1498 @interfaceutil.implementer(repository.imanifeststorage)
1492 1499 class manifestrevlog(object):
1493 1500 '''A revlog that stores manifest texts. This is responsible for caching the
@@ -1614,7 +1621,9 b' class manifestrevlog(object):'
1614 1621 readtree=None,
1615 1622 match=None,
1616 1623 ):
1617 if p1 in self.fulltextcache and util.safehasattr(m, b'fastdelta'):
1624 try:
1625 if p1 not in self.fulltextcache:
1626 raise FastdeltaUnavailable()
1618 1627 # If our first parent is in the manifest cache, we can
1619 1628 # compute a delta here using properties we know about the
1620 1629 # manifest up-front, which may save time later for the
@@ -1633,11 +1642,12 b' class manifestrevlog(object):'
1633 1642 n = self._revlog.addrevision(
1634 1643 text, transaction, link, p1, p2, cachedelta
1635 1644 )
1636 else:
1637 # The first parent manifest isn't already loaded, so we'll
1638 # just encode a fulltext of the manifest and pass that
1639 # through to the revlog layer, and let it handle the delta
1640 # process.
1645 except FastdeltaUnavailable:
1646 # The first parent manifest isn't already loaded or the
1647 # manifest implementation doesn't support fastdelta, so
1648 # we'll just encode a fulltext of the manifest and pass
1649 # that through to the revlog layer, and let it handle the
1650 # delta process.
1641 1651 if self._treeondisk:
1642 1652 assert readtree, b"readtree must be set for treemanifest writes"
1643 1653 assert match, b"match must be specified for treemanifest writes"
General Comments 0
You need to be logged in to leave comments. Login now