88
91
def test_saying_no_leaves_it_locked(self):
89
92
### if 'no' is answered, objects should remain locked.
90
93
self.wt.lock_write()
91
self.master_branch.lock_write()
93
# we need 5 yes's - wt, branch, repo, bound branch, bound repo.
94
self.run_bzr('break-lock', 'checkout', stdin="n\nn\nn\nn\nn\n")
95
# a new tree instance should not be lockable
96
wt = bzrlib.workingtree.WorkingTree.open('checkout')
97
self.assertRaises(errors.LockContention, wt.lock_write)
98
# and a new instance of the master branch
99
mb = wt.branch.get_master_branch()
100
self.assertRaises(errors.LockContention, mb.lock_write)
101
# unlock our branches normally.
103
self.master_branch.unlock()
95
self.master_branch.lock_write()
98
# we need 5 yes's - wt, branch, repo, bound branch, bound repo.
99
self.run_bzr('break-lock', 'checkout', stdin="n\nn\nn\nn\nn\n")
101
# The default timeout to wait for LockContention is 5 minutes.
102
# we need to override this temporarily.
103
# TODO: jam 20060927 When we have per repository/branch/tree
104
# timeouts set the value of the repository,
105
# rather than setting the global default.
106
orig_default = lockdir._DEFAULT_TIMEOUT_SECONDS
108
lockdir._DEFAULT_TIMEOUT_SECONDS = 1
109
# a new tree instance should not be lockable
110
wt = bzrlib.workingtree.WorkingTree.open('checkout')
111
self.assertRaises(errors.LockContention, wt.lock_write)
112
# and a new instance of the master branch
113
mb = wt.branch.get_master_branch()
114
self.assertRaises(errors.LockContention, mb.lock_write)
116
lockdir._DEFAULT_TIMEOUT_SECONDS = orig_default
117
# unlock our branches normally.
119
self.master_branch.unlock()
106
123
class TestBreakLockOldBranch(ExternalBase):