]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
filetable_new: fix the test
authorBrian Warner <warner@lothar.com>
Sun, 24 Dec 2006 19:47:03 +0000 (12:47 -0700)
committerBrian Warner <warner@lothar.com>
Sun, 24 Dec 2006 19:47:03 +0000 (12:47 -0700)
src/allmydata/filetable_new.py

index 0ab130fb1221faf9a5209809c9ee68e40fb9ed5f..215da26c3d51b912be205ac0c75efc59dfdfa6ea 100644 (file)
@@ -265,13 +265,19 @@ class _SubTreeMixin(object):
 class _MutableSubTreeMixin(object):
 
     def add(self, path, child, opener, work_queue):
-        d = self.find_lowest_containing_subtree_for_path(path, opener)
+        assert len(path) > 0
+        d = self.find_lowest_containing_subtree_for_path(path[:-1], opener)
         def _found(res):
             subtree, prepath, postpath = res
             assert IMutableSubTree.providedBy(subtree)
+            # postpath is from the top of the subtree to the directory where
+            # this child should be added. add_subpath wants the path from the
+            # top of the subtree to the child itself, so we need to append
+            # the child's name here.
+            addpath = postpath + [path[-1]]
             # this add_path will cause some steps to be added, as well as the
             # internal node to be modified
-            d1 = subtree.add_subpath(postpath, child, work_queue)
+            d1 = subtree.add_subpath(addpath, child, work_queue)
             if subtree.mutation_affects_parent():
                 def _added(boxname):
                     work_queue.add_addpath(boxname, prepath)