[MERGE] Support walkdirs correctly in PreviewTree

Ian Clatworthy ian.clatworthy at canonical.com
Fri Jul 25 06:26:31 BST 2008


Aaron Bentley wrote:
> Hi all,
> 
> This patch implements walkdirs in terms of TreeTransform, and also
> enhances the testing of walkdirs so that versioned_kind is shown to work.

bb:tweak

> +    def test_walkdirs(self):
> +        preview = self.get_empty_preview()
> +        preview.version_file('tree-root', preview.root)
> +        preview_tree = preview.get_preview_tree()
> +        file_trans_id = preview.new_file('a', preview.root, 'contents',
> +                                         'a-id')
> +        expected = [(('', 'tree-root'),
> +                    [('a', 'a', 'file', None, 'a-id', 'file')])]
> +        self.assertEqual(expected, list(preview_tree.walkdirs()))

I think this test ought to be enhanced to test the result when there
are 2 directories (i.e. sort order is as expected) and a file nested
within one of those directories. Currently, it feels a little light on.

> +                try:
> +                    kind = self._transform.final_kind(child_id)
> +                    versioned_kind = kind

Will this always be correct? If the kind of a file changes, could
the versioned_kind be different to the current kind?

Ian C.



More information about the bazaar mailing list