Rev 3058: Change the lock check to raise ObjectNotLocked. in http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/is_ancestor_fix
John Arbash Meinel
john at arbash-meinel.com
Fri Nov 30 15:59:30 GMT 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.93-dev/is_ancestor_fix
------------------------------------------------------------
revno: 3058
revision-id:john at arbash-meinel.com-20071130155902-03cqo1ynbg2x7x5a
parent: john at arbash-meinel.com-20071130154827-dh5a4gr3d0gfk1m0
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: is_ancestor_fix
timestamp: Fri 2007-11-30 09:59:02 -0600
message:
Change the lock check to raise ObjectNotLocked.
modified:
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
-------------- next part --------------
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2007-11-28 21:55:07 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2007-11-30 15:59:02 +0000
@@ -1033,7 +1033,8 @@
def ensure_loaded(self):
# NB: if you see an assertion error here, its probably access against
# an unlocked repo. Naughty.
- assert self.repo.is_locked()
+ if not self.repo.is_locked():
+ raise errors.ObjectNotLocked(self.repo)
if self._names is None:
self._names = {}
self._packs_at_load = set()
@@ -1569,7 +1570,8 @@
:returns: an iterator yielding tuples of (revison-id, parents-in-index,
parents-in-revision).
"""
- assert self.is_locked()
+ if not self.is_locked():
+ raise errors.ObjectNotLocked(self)
pb = ui.ui_factory.nested_progress_bar()
result = []
try:
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py 2007-11-27 20:35:02 +0000
+++ b/bzrlib/tests/test_repository.py 2007-11-30 15:59:02 +0000
@@ -1195,7 +1195,13 @@
repo = self.make_repository('.', format=format)
packs = repo._pack_collection
self.assertEqual([0], packs.pack_distribution(0))
-
+
+ def test_ensure_loaded_unlocked(self):
+ format = self.get_format()
+ repo = self.make_repository('.', format=format)
+ self.assertRaises(errors.ObjectNotLocked,
+ repo._pack_collection.ensure_loaded)
+
def test_pack_distribution_one_to_nine(self):
format = self.get_format()
repo = self.make_repository('.', format=format)
More information about the bazaar-commits
mailing list