~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2009-07-24 03:15:56 UTC
  • mfrom: (4565 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4566.
  • Revision ID: mbp@sourcefrog.net-20090724031556-5zyef6f1ixtn6r3z
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007, 2008, 2009 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
150
150
        self.run_bzr('switch --force branch1', working_dir='tree')
151
151
        branch_location = WorkingTree.open('tree').branch.base
152
152
        self.assertEndsWith(branch_location, 'branch1/')
 
153
 
 
154
    def test_create_branch_no_branch(self):
 
155
        self.prepare_lightweight_switch()
 
156
        self.run_bzr_error(['cannot create branch without source branch'],
 
157
            'switch --create-branch ../branch2', working_dir='tree')
 
158
 
 
159
    def test_create_branch(self):
 
160
        branch = self.make_branch('branch')
 
161
        tree = branch.create_checkout('tree', lightweight=True)
 
162
        tree.commit('one', rev_id='rev-1')
 
163
        self.run_bzr('switch --create-branch ../branch2', working_dir='tree')
 
164
        tree = WorkingTree.open('tree')
 
165
        self.assertEndsWith(tree.branch.base, '/branch2/')
 
166
 
 
167
    def test_create_branch_local(self):
 
168
        branch = self.make_branch('branch')
 
169
        tree = branch.create_checkout('tree', lightweight=True)
 
170
        tree.commit('one', rev_id='rev-1')
 
171
        self.run_bzr('switch --create-branch branch2', working_dir='tree')
 
172
        tree = WorkingTree.open('tree')
 
173
        # The new branch should have been created at the same level as
 
174
        # 'branch', because we did not have a '/' segment
 
175
        self.assertEqual(branch.base[:-1] + '2/', tree.branch.base)
 
176
 
 
177
    def test_create_branch_short_name(self):
 
178
        branch = self.make_branch('branch')
 
179
        tree = branch.create_checkout('tree', lightweight=True)
 
180
        tree.commit('one', rev_id='rev-1')
 
181
        self.run_bzr('switch -b branch2', working_dir='tree')
 
182
        tree = WorkingTree.open('tree')
 
183
        # The new branch should have been created at the same level as
 
184
        # 'branch', because we did not have a '/' segment
 
185
        self.assertEqual(branch.base[:-1] + '2/', tree.branch.base)