Rev 4685: (garyvdm) Unlock trees even if we fail to create a TreeTransform in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Sep 11 16:40:10 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4685 [merge]
revision-id: pqm at pqm.ubuntu.com-20090911154008-l1xi5q6zuot83p2v
parent: pqm at pqm.ubuntu.com-20090910084352-dnlxfwi1ovyjfe0e
parent: v.ladeuil+lp at free.fr-20090911144435-rzpr5uwz0bgwns7k
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-09-11 16:40:08 +0100
message:
(garyvdm) Unlock trees even if we fail to create a TreeTransform
object
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/merge.py merge.py-20050513021216-953b65a438527106
bzrlib/tests/test_merge.py testmerge.py-20050905070950-c1b5aa49ff911024
=== modified file 'NEWS'
--- a/NEWS 2009-09-09 15:43:52 +0000
+++ b/NEWS 2009-09-11 14:23:16 +0000
@@ -69,6 +69,10 @@
repository, such as revisions without inventories or inventories without
chk_bytes root records.
(Andrew Bennetts, #423506)
+
+* Make sure that we unlock the tree if we fail to create a TreeTransform
+ object when doing a merge, and there is limbo, or pending-deletions
+ directory. (Gary van der Merwe, #427773)
Improvements
************
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py 2009-08-28 05:00:33 +0000
+++ b/bzrlib/merge.py 2009-09-11 13:32:55 +0000
@@ -613,19 +613,21 @@
self.this_tree.lock_tree_write()
self.base_tree.lock_read()
self.other_tree.lock_read()
- self.tt = TreeTransform(self.this_tree, self.pb)
try:
- self.pp.next_phase()
- self._compute_transform()
- self.pp.next_phase()
- results = self.tt.apply(no_conflicts=True)
- self.write_modified(results)
+ self.tt = TreeTransform(self.this_tree, self.pb)
try:
- self.this_tree.add_conflicts(self.cooked_conflicts)
- except UnsupportedOperation:
- pass
+ self.pp.next_phase()
+ self._compute_transform()
+ self.pp.next_phase()
+ results = self.tt.apply(no_conflicts=True)
+ self.write_modified(results)
+ try:
+ self.this_tree.add_conflicts(self.cooked_conflicts)
+ except UnsupportedOperation:
+ pass
+ finally:
+ self.tt.finalize()
finally:
- self.tt.finalize()
self.other_tree.unlock()
self.base_tree.unlock()
self.this_tree.unlock()
=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py 2009-08-28 05:00:33 +0000
+++ b/bzrlib/tests/test_merge.py 2009-09-11 13:32:55 +0000
@@ -36,7 +36,7 @@
from bzrlib.osutils import pathjoin, file_kind
from bzrlib.tests import TestCaseWithTransport, TestCaseWithMemoryTransport
from bzrlib.workingtree import WorkingTree
-
+from bzrlib.transform import TreeTransform
class TestMerge(TestCaseWithTransport):
"""Test appending more than one revision"""
@@ -284,7 +284,8 @@
except AttributeError:
self.fail('tried to join a path when name was None')
- def test_merge_uncommitted_otherbasis_ancestor_of_thisbasis(self):
+
+ def test_merge_existing_limbo_or_pending_deletion(self):
tree_a = self.make_branch_and_tree('a')
self.build_tree(['a/file_1', 'a/file_2'])
tree_a.add(['file_1'])
@@ -1143,6 +1144,27 @@
'X\n'
'e\n', 'test/foo')
+ def get_limbodir_deletiondir(self, wt):
+ transform = TreeTransform(wt)
+ limbodir = transform._limbodir
+ deletiondir = transform._deletiondir
+ transform.finalize()
+ return (limbodir, deletiondir)
+
+ def test_merge_with_existing_limbo(self):
+ wt = self.make_branch_and_tree('this')
+ (limbodir, deletiondir) = self.get_limbodir_deletiondir(wt)
+ os.mkdir(limbodir)
+ self.assertRaises(errors.ExistingLimbo, self.do_merge, wt, wt)
+ self.assertRaises(errors.LockError, wt.unlock)
+
+ def test_merge_with_pending_deletion(self):
+ wt = self.make_branch_and_tree('this')
+ (limbodir, deletiondir) = self.get_limbodir_deletiondir(wt)
+ os.mkdir(deletiondir)
+ self.assertRaises(errors.ExistingPendingDeletion, self.do_merge, wt, wt)
+ self.assertRaises(errors.LockError, wt.unlock)
+
class TestMerge3Merge(TestCaseWithTransport, TestMergeImplementation):
More information about the bazaar-commits
mailing list