35
36
self.start_logging_connections()
38
# make sure that the cwd is the branch
41
# install lock hooks to find out about cmd_revert's locking actions
44
lock.Lock.hooks.install_named_hook('lock_acquired',
45
locks_acquired.append, None)
46
lock.Lock.hooks.install_named_hook('lock_released',
47
locks_released.append, None)
49
# execute the revert command (There is nothing to actually revert,
50
# but locks are acquired either way.)
39
51
revert = builtins.cmd_revert()
40
num_before = len(self._lock_actions)
42
num_after = len(self._lock_actions)
44
# only expect the working tree to be locked and released, so 2
46
self.assertEquals(num_before+2, num_after)
48
# def test_commit_both_modified(self):
49
# self.master_wt.commit('empty commit on master')
50
# self.start_logging_connections()
52
# commit = builtins.cmd_commit()
53
# # commit do not provide a directory parameter, we have to change dir
56
# # cmd_commit translates BoundBranchOutOfDate into BzrCommandError
57
# self.assertRaises(errors.BzrCommandError, commit.run,
58
# message=u'empty commit', unchanged=True)
59
# self.assertEquals(1, len(self.connections))
61
# def test_commit_local(self):
62
# """Commits with --local should not connect to the master!"""
63
# self.start_logging_connections()
65
# commit = builtins.cmd_commit()
66
# # commit do not provide a directory parameter, we have to change dir
69
# commit.run(message=u'empty commit', unchanged=True, local=True)
71
# #it shouldn't open any connections
72
# self.assertEquals(0, len(self.connections))
54
# make sure that only one lock is acquired and released.
55
self.assertEqual(1, len(locks_acquired))
56
self.assertEqual(1, len(locks_released))
58
# make sure that the nonces are the same, since otherwise
59
# this would not be the same lock.
60
self.assertEqual(locks_acquired[0].details, locks_released[0].details)
62
# make sure that the locks are checkout locks.
63
self.assertEndsWith(locks_acquired[0].lock_url, "/checkout/lock")
64
self.assertEndsWith(locks_released[0].lock_url, "/checkout/lock")