John Arbash Meinel
john at arbash-meinel.com
Wed Jul 26 21:36:25 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Robert Collins wrote:
> This is the first cut at InterTree - I've hooked it up to Tree.compare.
> From here I plan to expand the tests until all the parameters are
> present and minimally tested. At that point I intend to deprecate
> compare_trees as the public interface.
> I'm sending this in now for comments and feedback..
> - def get_tree_no_parents_no_content(self):
> - # make a working tree with the right shape
> - tree = self.make_branch_and_tree('.')
> + def get_tree_no_parents_no_content(self, empty_tree, converter=None):
> + """Make a tree with no parents and no contents from empty_tree.
> + :param empty_tree: A working tree with no content and no parents to
> + modify.
> + """
> # convert that to the final shape
> - return self.workingtree_to_test_tree(tree)
> + if converter is None:
> + converter = self.workingtree_to_test_tree
> + return converter(empty_tree)
This kind of seems like an odd api. Where you have to pass in an empty
tree, in order to get an empty tree.
I understand you really want it because you want to use the converter
> class TreeTestProviderAdapter(WorkingTreeTestProviderAdapter):
> === modified file 'bzrlib/tests/tree_implementations/test_test_trees.py'
> --- bzrlib/tests/tree_implementations/test_test_trees.py 2006-07-21 01:37:47 +0000
> +++ bzrlib/tests/tree_implementations/test_test_trees.py 2006-07-24 10:15:48 +0000
> @@ -23,7 +23,8 @@
> class TestTreeShapes(TestCaseWithTree):
> def test_empty_tree_no_parents(self):
> - tree = self.get_tree_no_parents_no_content()
> + tree = self.make_branch_and_tree('.')
> + tree = self.get_tree_no_parents_no_content(tree)
> self.assertEqual(, tree.get_parent_ids())
> self.assertEqual(, tree.conflicts())
> self.assertEqual(, list(tree.unknowns()))
But it leads to a bit of:
Give me an empty tree.
No really, I want an empty tree.
Otherwise +1 from me.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v126.96.36.199 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
More information about the bazaar