~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_break_lock.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from bzrlib import (
20
20
    branch,
21
 
    bzrdir,
22
21
    config,
 
22
    controldir,
23
23
    errors,
24
24
    osutils,
25
25
    tests,
26
26
    )
 
27
from bzrlib.tests.matchers import ContainsNoVfsCalls
27
28
from bzrlib.tests.script import (
28
29
    run_script,
29
30
    )
53
54
             'repo/',
54
55
             'repo/branch/',
55
56
             'checkout/'])
56
 
        bzrdir.BzrDir.create('master-repo').create_repository()
57
 
        self.master_branch = bzrdir.BzrDir.create_branch_convenience(
 
57
        controldir.ControlDir.create('master-repo').create_repository()
 
58
        self.master_branch = controldir.ControlDir.create_branch_convenience(
58
59
            'master-repo/master-branch')
59
 
        bzrdir.BzrDir.create('repo').create_repository()
60
 
        local_branch = bzrdir.BzrDir.create_branch_convenience('repo/branch')
 
60
        controldir.ControlDir.create('repo').create_repository()
 
61
        local_branch = controldir.ControlDir.create_branch_convenience('repo/branch')
61
62
        local_branch.bind(self.master_branch)
62
 
        checkoutdir = bzrdir.BzrDir.create('checkout')
63
 
        branch.BranchReferenceFormat().initialize(
64
 
            checkoutdir, target_branch=local_branch)
 
63
        checkoutdir = controldir.ControlDir.create('checkout')
 
64
        checkoutdir.set_branch_reference(local_branch)
65
65
        self.wt = checkoutdir.create_workingtree()
66
66
 
67
67
    def test_break_lock_help(self):
124
124
                     stdin="y\n")
125
125
        self.assertRaises(errors.LockBroken, self.config.unlock)
126
126
 
 
127
 
 
128
class TestSmartServerBreakLock(tests.TestCaseWithTransport):
 
129
 
 
130
    def test_simple_branch_break_lock(self):
 
131
        self.setup_smart_server_with_call_log()
 
132
        t = self.make_branch_and_tree('branch')
 
133
        t.branch.lock_write()
 
134
        self.reset_smart_call_log()
 
135
        out, err = self.run_bzr(['break-lock', '--force', self.get_url('branch')])
 
136
        # This figure represent the amount of work to perform this use case. It
 
137
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
138
        # being too low. If rpc_count increases, more network roundtrips have
 
139
        # become necessary for this use case. Please do not adjust this number
 
140
        # upwards without agreement from bzr's network support maintainers.
 
141
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
142
        self.assertLength(1, self.hpss_connections)
 
143
        self.assertLength(5, self.hpss_calls)