~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-06-18 11:43:07 UTC
  • mfrom: (6437.54.10 2.5)
  • mto: This revision was merged to the branch mainline in revision 6525.
  • Revision ID: jelmer@samba.org-20120618114307-zeazlym311p38m98
MergeĀ 2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
import os
22
22
 
23
 
from bzrlib.bzrdir import BzrDir
 
23
from bzrlib.controldir import ControlDir
24
24
from bzrlib import (
25
 
        osutils,
26
 
        urlutils,
27
 
        branch,
28
 
        )
 
25
    osutils,
 
26
    urlutils,
 
27
    branch,
 
28
    )
29
29
from bzrlib.workingtree import WorkingTree
30
30
from bzrlib.tests import (
31
 
        TestCaseWithTransport,
32
 
        script,
33
 
        )
 
31
    TestCaseWithTransport,
 
32
    script,
 
33
    )
34
34
from bzrlib.tests.features import UnicodeFilenameFeature
35
35
from bzrlib.directory_service import directories
36
36
 
174
174
        checkout = checkout.bzrdir.open_workingtree()
175
175
        self.assertEqual(tree2.branch.base, checkout.branch.base)
176
176
 
 
177
    def test_switch_finds_relative_unicode_branch(self):
 
178
        """Switch will find 'foo' relative to the branch the checkout is of."""
 
179
        self.requireFeature(UnicodeFilenameFeature)
 
180
        self.build_tree(['repo/'])
 
181
        tree1 = self.make_branch_and_tree('repo/brancha')
 
182
        tree1.commit('foo')
 
183
        tree2 = self.make_branch_and_tree(u'repo/branch\xe9')
 
184
        tree2.pull(tree1.branch)
 
185
        branchb_id = tree2.commit('bar')
 
186
        checkout =  tree1.branch.create_checkout('checkout', lightweight=True)
 
187
        self.run_bzr(['switch', u'branch\xe9'], working_dir='checkout')
 
188
        self.assertEqual(branchb_id, checkout.last_revision())
 
189
        checkout = checkout.bzrdir.open_workingtree()
 
190
        self.assertEqual(tree2.branch.base, checkout.branch.base)
 
191
 
177
192
    def test_switch_revision(self):
178
193
        tree = self._create_sample_tree()
179
194
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
237
252
        tree.add('file-1')
238
253
        revid1 = tree.commit('rev1')
239
254
        self.run_bzr(['switch', '-b', 'anotherbranch'], working_dir='branch-1')
240
 
        bzrdir = BzrDir.open("branch-1")
 
255
        bzrdir = ControlDir.open("branch-1")
241
256
        self.assertEquals(
242
257
            set([b.name for b in bzrdir.list_branches()]),
243
258
            set(["foo", "anotherbranch"]))
256
271
        tree.add('file-1')
257
272
        revid1 = tree.commit('rev1')
258
273
        self.run_bzr(['switch', '-b', u'branch\xe9'], working_dir='branch-1')
259
 
        bzrdir = BzrDir.open("branch-1")
 
274
        bzrdir = ControlDir.open("branch-1")
260
275
        self.assertEquals(
261
276
            set([b.name for b in bzrdir.list_branches()]),
262
277
            set(["foo", u"branch\xe9"]))
475
490
        # become necessary for this use case. Please do not adjust this number
476
491
        # upwards without agreement from bzr's network support maintainers.
477
492
        self.assertLength(24, self.hpss_calls)
478
 
        self.assertLength(5, self.hpss_connections)
 
493
        self.assertLength(4, self.hpss_connections)
479
494
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)