Rev 4122: Provide a __len__ on HookPoint so that 'if somehookpoint' will behave as it did when they were lists. in http://people.ubuntu.com/~robertc/baz2.0/pending/Hooks.docs
Robert Collins
robertc at robertcollins.net
Thu Mar 12 08:34:56 GMT 2009
At http://people.ubuntu.com/~robertc/baz2.0/pending/Hooks.docs
------------------------------------------------------------
revno: 4122
revision-id: robertc at robertcollins.net-20090312083453-kvg3z61lgepkmh96
parent: robertc at robertcollins.net-20090312062439-gigl7rnor6t2cbcz
committer: Robert Collins <robertc at robertcollins.net>
branch nick: Hooks.docs
timestamp: Thu 2009-03-12 19:34:53 +1100
message:
Provide a __len__ on HookPoint so that 'if somehookpoint' will behave as it did when they were lists.
=== modified file 'bzrlib/hooks.py'
--- a/bzrlib/hooks.py 2009-03-12 06:24:39 +0000
+++ b/bzrlib/hooks.py 2009-03-12 08:34:53 +0000
@@ -241,6 +241,9 @@
def __iter__(self):
return iter(self._callbacks)
+ def __len__(self):
+ return len(self._callbacks)
+
def __repr__(self):
strings = []
strings.append("<%s(" % type(self).__name__)
=== modified file 'bzrlib/tests/branch_implementations/test_revision_history.py'
--- a/bzrlib/tests/branch_implementations/test_revision_history.py 2008-06-16 16:55:05 +0000
+++ b/bzrlib/tests/branch_implementations/test_revision_history.py 2009-03-12 08:34:53 +0000
@@ -124,8 +124,6 @@
cause the revision history to be cached.
"""
branch, calls = self.get_instrumented_branch()
- # Lock the branch, set the revision history, then repeatedly call
- # revision_history.
branch.set_revision_history([])
branch.revision_history()
self.assertEqual(['_gen_revision_history'], calls)
More information about the bazaar-commits
mailing list