[MERGE] Support walkdirs correctly in PreviewTree

Aaron Bentley aaron at aaronbentley.com
Fri Jul 25 13:17:06 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ian Clatworthy wrote:
>> 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.

Walkdirs is already thoroughly tested by the tree_implementation tests,
and PreviewTree is tested by the tree_implementation tests.  If there
are deficiencies in the tree_implementation tests, we should correct
them there, not in test_transform.

>> +                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?

On-disk changes always have the potential to change the versioned_kind,
e.g. changing from 'directory' to 'tree-reference', so I assumed the
versioned_kind could change if the regular kind did.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIicRC0F+nu1YWqI0RAow7AJ0YsFgdKXnsUPGPq734Grva8tsOeQCdFoLD
P4OVLWjlER0ETP4nM2iFPYQ=
=hPfa
-----END PGP SIGNATURE-----



More information about the bazaar mailing list