~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-04-09 20:23:07 UTC
  • mfrom: (4265.1.4 bbc-merge)
  • Revision ID: pqm@pqm.ubuntu.com-20090409202307-n0depb16qepoe21o
(jam) Change _fetch_uses_deltas = False for CHK repos until we can
        write a better fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2007 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
133
133
        self.run_bzr(['switch', 'branchb'], working_dir='heavyco/a')
134
134
        self.assertEqual(branchb_id, checkout.last_revision())
135
135
        self.assertEqual(tree2.branch.base, checkout.branch.get_bound_location())
136
 
 
137
 
    def prepare_lightweight_switch(self):
138
 
        branch = self.make_branch('branch')
139
 
        branch.create_checkout('tree', lightweight=True)
140
 
        os.rename('branch', 'branch1')
141
 
 
142
 
    def test_switch_lightweight_after_branch_moved(self):
143
 
        self.prepare_lightweight_switch()
144
 
        self.run_bzr('switch --force ../branch1', working_dir='tree')
145
 
        branch_location = WorkingTree.open('tree').branch.base
146
 
        self.assertEndsWith(branch_location, 'branch1/')
147
 
 
148
 
    def test_switch_lightweight_after_branch_moved_relative(self):
149
 
        self.prepare_lightweight_switch()
150
 
        self.run_bzr('switch --force branch1', working_dir='tree')
151
 
        branch_location = WorkingTree.open('tree').branch.base
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)