Rev 2414: Lock the tree when using a commit builder. in http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
John Arbash Meinel
john at arbash-meinel.com
Mon Feb 26 15:29:47 GMT 2007
At http://bazaar.launchpad.net/%7Ebzr/bzr/dirstate
------------------------------------------------------------
revno: 2414
revision-id: john at arbash-meinel.com-20070226152717-3so5kz4v7wz7dmpk
parent: robertc at robertcollins.net-20070226055444-qozx06g4s1749uky
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate
timestamp: Mon 2007-02-26 09:27:17 -0600
message:
Lock the tree when using a commit builder.
modified:
bzrlib/tests/repository_implementations/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
-------------- next part --------------
=== modified file 'bzrlib/tests/repository_implementations/test_commit_builder.py'
--- a/bzrlib/tests/repository_implementations/test_commit_builder.py 2007-02-10 02:48:43 +0000
+++ b/bzrlib/tests/repository_implementations/test_commit_builder.py 2007-02-26 15:27:17 +0000
@@ -32,7 +32,11 @@
def record_root(self, builder, tree):
if builder.record_root_entry is True:
- ie = tree.inventory.root
+ tree.lock_read()
+ try:
+ ie = tree.inventory.root
+ finally:
+ tree.unlock()
parent_tree = tree.branch.repository.revision_tree(None)
parent_invs = []
builder.record_entry_contents(ie, parent_invs, '', tree)
@@ -86,13 +90,17 @@
raise tests.TestSkipped('Format requires root')
self.build_tree(['foo'])
tree.add('foo', 'foo-id')
- entry = tree.inventory['foo-id']
- builder = tree.branch.get_commit_builder([])
- self.callDeprecated(['Root entry should be supplied to'
- ' record_entry_contents, as of bzr 0.10.'],
- builder.record_entry_contents, entry, [], 'foo', tree)
- builder.finish_inventory()
- rev_id = builder.commit('foo bar')
+ tree.lock_write()
+ try:
+ entry = tree.inventory['foo-id']
+ builder = tree.branch.get_commit_builder([])
+ self.callDeprecated(['Root entry should be supplied to'
+ ' record_entry_contents, as of bzr 0.10.'],
+ builder.record_entry_contents, entry, [], 'foo', tree)
+ builder.finish_inventory()
+ rev_id = builder.commit('foo bar')
+ finally:
+ tree.unlock()
def test_commit(self):
tree = self.make_branch_and_tree(".")
More information about the bazaar-commits
mailing list