[PATCH 2 of 8] manifest: remove dependency on treeinmem from manifest.add

Durham Goode durham at fb.com
Wed Sep 14 19:04:32 EDT 2016


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1473893509 25200
#      Wed Sep 14 15:51:49 2016 -0700
# Node ID d02a33fbe958ea7cec4976f0fdc652264ac013bc
# Parent  a68f73ff397c439410395363049a0679a847b425
manifest: remove dependency on treeinmem from manifest.add

Currently manifest.add uses the treeinmem option to know if it can call
fastdelta on the given manifest instance. In a future patch we will be moving
add() to be on the manifestrevlog, so it won't have access to the treeinmem
option anymore. Instead, let's have it actually check if the given manifest
instance supports the fastdelta operation.

This also means that if treemanifest or any implementation eventually implements
fastdelta(), it will automatically benefit from this code path.

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1241,7 +1241,7 @@ class manifest(manifestrevlog):
             return None, None
 
     def add(self, m, transaction, link, p1, p2, added, removed):
-        if (p1 in self.fulltextcache and not self._treeinmem
+        if (p1 in self.fulltextcache and util.safehasattr(m, 'fastdelta')
             and not self._usemanifestv2):
             # If our first parent is in the manifest cache, we can
             # compute a delta here using properties we know about the


More information about the Mercurial-devel mailing list