bug? iter_entries() skips from_dir entry
Aaron Bentley
aaron.bentley at utoronto.ca
Tue Apr 19 19:12:28 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
For a given Inventory inv, the following assertion fails:
assert len(inv) == len([f for f in inv.iter_entries()])
This is because iter_entries does not yield the entry for from_dir. It
can be fixed like this:
- --- orig/bzrlib/inventory.py
+++ mod/bzrlib/inventory.py
@@ -334,6 +334,7 @@
~ if from_dir == None:
~ assert self.root
~ from_dir = self.root
+ yield from_dir.name, from_dir
~ elif isinstance(from_dir, basestring):
~ from_dir = self._byid[from_dir]
This breaks other operations, like Inventory.to_element, and
InventoryEntry.copy, because the RootEntry lacks certain fields: text_id
and text_size.
Is it intentional that Inventory.__len__ !=
len(list(Inventory.iter_entries())) ?
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCZUoM0F+nu1YWqI0RApOeAJ4kgGu4cXJbAcecBUs242G6MKv3hgCff3HR
wwfS9t3YNLf0YhfMRWNJ4mM=
=NzBH
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list