##// 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 Returns a 2-tuple containing ``bytearray(self.text())`` and the
1053 Returns a 2-tuple containing ``bytearray(self.text())`` and the
1054 delta between ``base`` and this manifest.
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 ret._dirty = True
1212 ret._dirty = True
1213 return ret
1213 return ret
1214
1214
1215 def fastdelta(self, base, changes):
1216 raise FastdeltaUnavailable()
1217
1215 def diff(self, m2, match=None, clean=False):
1218 def diff(self, m2, match=None, clean=False):
1216 '''Finds changes between the current manifest and m2.
1219 '''Finds changes between the current manifest and m2.
1217
1220
@@ -1488,6 +1491,10 b' class manifestfulltextcache(util.lrucach'
1488 MAXCOMPRESSION = 3
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 @interfaceutil.implementer(repository.imanifeststorage)
1498 @interfaceutil.implementer(repository.imanifeststorage)
1492 class manifestrevlog(object):
1499 class manifestrevlog(object):
1493 '''A revlog that stores manifest texts. This is responsible for caching the
1500 '''A revlog that stores manifest texts. This is responsible for caching the
@@ -1614,7 +1621,9 b' class manifestrevlog(object):'
1614 readtree=None,
1621 readtree=None,
1615 match=None,
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 # If our first parent is in the manifest cache, we can
1627 # If our first parent is in the manifest cache, we can
1619 # compute a delta here using properties we know about the
1628 # compute a delta here using properties we know about the
1620 # manifest up-front, which may save time later for the
1629 # manifest up-front, which may save time later for the
@@ -1633,11 +1642,12 b' class manifestrevlog(object):'
1633 n = self._revlog.addrevision(
1642 n = self._revlog.addrevision(
1634 text, transaction, link, p1, p2, cachedelta
1643 text, transaction, link, p1, p2, cachedelta
1635 )
1644 )
1636 else:
1645 except FastdeltaUnavailable:
1637 # The first parent manifest isn't already loaded, so we'll
1646 # The first parent manifest isn't already loaded or the
1638 # just encode a fulltext of the manifest and pass that
1647 # manifest implementation doesn't support fastdelta, so
1639 # through to the revlog layer, and let it handle the delta
1648 # we'll just encode a fulltext of the manifest and pass
1640 # process.
1649 # that through to the revlog layer, and let it handle the
1650 # delta process.
1641 if self._treeondisk:
1651 if self._treeondisk:
1642 assert readtree, b"readtree must be set for treemanifest writes"
1652 assert readtree, b"readtree must be set for treemanifest writes"
1643 assert match, b"match must be specified for treemanifest writes"
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