~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-04-16 11:08:11 UTC
  • mfrom: (6521 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6522.
  • Revision ID: jelmer@samba.org-20120416110811-0y996ihqy9o2bb1t
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2012 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
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
 
153
153
        branchb_id = tree2.commit('bar')
154
154
        checkout = tree1.branch.create_checkout('heavyco/a', lightweight=False)
155
155
        self.run_bzr(['switch', 'branchb'], working_dir='heavyco/a')
 
156
        # Refresh checkout as 'switch' modified it
 
157
        checkout = checkout.bzrdir.open_workingtree()
156
158
        self.assertEqual(branchb_id, checkout.last_revision())
157
 
        self.assertEqual(tree2.branch.base, checkout.branch.get_bound_location())
 
159
        self.assertEqual(tree2.branch.base,
 
160
                         checkout.branch.get_bound_location())
158
161
 
159
162
    def test_switch_finds_relative_unicode_branch(self):
160
163
        """Switch will find 'foo' relative to the branch the checkout is of."""
188
191
        revid2 = tree.commit('rev2')
189
192
        self.run_bzr(['switch', '-b', 'anotherbranch'])
190
193
        self.assertEquals(
191
 
            ['', 'anotherbranch'],
192
 
            tree.branch.bzrdir.get_branches().keys())
 
194
            set(['', 'anotherbranch']),
 
195
            set(tree.branch.bzrdir.get_branches().keys()))
193
196
 
194
197
    def test_switch_into_unrelated_colocated(self):
195
198
        # Create a new colocated branch from an existing non-colocated branch.
234
237
        tree.add('file-1')
235
238
        revid1 = tree.commit('rev1')
236
239
        self.run_bzr(['switch', '-b', 'anotherbranch'], working_dir='branch-1')
237
 
        bzrdir = BzrDir.open("branch-1")
 
240
        bzrdir = ControlDir.open("branch-1")
238
241
        self.assertEquals(
239
242
            set([b.name for b in bzrdir.list_branches()]),
240
243
            set(["foo", "anotherbranch"]))
253
256
        tree.add('file-1')
254
257
        revid1 = tree.commit('rev1')
255
258
        self.run_bzr(['switch', '-b', u'branch\xe9'], working_dir='branch-1')
256
 
        bzrdir = BzrDir.open("branch-1")
 
259
        bzrdir = ControlDir.open("branch-1")
257
260
        self.assertEquals(
258
261
            set([b.name for b in bzrdir.list_branches()]),
259
262
            set(["foo", u"branch\xe9"]))
472
475
        # become necessary for this use case. Please do not adjust this number
473
476
        # upwards without agreement from bzr's network support maintainers.
474
477
        self.assertLength(24, self.hpss_calls)
475
 
        self.assertLength(5, self.hpss_connections)
 
478
        self.assertLength(4, self.hpss_connections)
476
479
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)