[brisbane-core:MERGE] Some cleanups around tree.iter_changes
John Arbash Meinel
john at arbash-meinel.com
Tue Mar 10 02:17:16 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Vincent Ladeuil wrote:
> This patch provides a proper InterTree object for trees that both use
> CHKInventories.
>
> Feedback welcome on the test parametrization in particular,
>
> Vincent
>
>
+ def is_compatible(source, target):
+ if (isinstance(source, RevisionTree)
+ and isinstance(target, RevisionTree)):
+ try:
+ # Only CHK inventories have id_to_entry attribute
+ source.inventory.id_to_entry
+ target.inventory.id_to_entry
+ return True
+ except AttributeError:
+ pass
+ return False
^- I think this is better written as:
if (getattr(source.inventory, 'id_to_entry', None) is not None
and getattr(target.inventory, 'id_to_entry', None) is not None):
return True
return False
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkm1zawACgkQJdeBCYSNAAMCGgCgxBXv89A9pgoZT+juGrGF2ZC7
glUAoLQ3qOfaZoLOan2EAezArwU+tLUP
=F+TR
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list