~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Daniel Watkins
  • Date: 2009-02-09 18:03:20 UTC
  • mto: This revision was merged to the branch mainline in revision 4964.
  • Revision ID: daniel@daniel-watkins.co.uk-20090209180320-rwcaetl8kjhuvsq2
Extracted common setup code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
class TestSwitch(ExternalBase):
28
28
 
 
29
    def _create_sample_tree(self):
 
30
        tree = self.make_branch_and_tree('branch-1')
 
31
        self.build_tree(['branch-1/file-1', 'branch-1/file-2'])
 
32
        tree.add('file-1')
 
33
        tree.commit('rev1')
 
34
        tree.add('file-2')
 
35
        tree.commit('rev2')
 
36
        return tree
 
37
 
29
38
    def test_switch_up_to_date_light_checkout(self):
30
39
        self.make_branch_and_tree('branch')
31
40
        self.run_bzr('branch branch branch2')
135
144
        self.assertEqual(tree2.branch.base, checkout.branch.get_bound_location())
136
145
 
137
146
    def test_switch_revision(self):
138
 
        tree = self.make_branch_and_tree('branch-1')
139
 
        self.build_tree(['branch-1/file-1', 'branch-1/file-2'])
140
 
        tree.add('file-1')
141
 
        tree.commit('rev1')
142
 
        tree.add('file-2')
143
 
        tree.commit('rev2')
 
147
        tree = self._create_sample_tree()
144
148
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
145
149
        self.run_bzr(['switch', 'branch-1', '-r1'], working_dir='checkout')
146
150
        self.failUnlessExists('checkout/file-1')
147
151
        self.failIfExists('checkout/file-2')
148
152
 
149
153
    def test_switch_only_revision(self):
150
 
        tree = self.make_branch_and_tree('branch-1')
151
 
        self.build_tree(['branch-1/file-1', 'branch-1/file-2'])
152
 
        tree.add('file-1')
153
 
        tree.commit('rev1')
154
 
        tree.add('file-2')
155
 
        tree.commit('rev2')
 
154
        tree = self._create_sample_tree()
156
155
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
157
156
        self.failUnlessExists('checkout/file-1')
158
157
        self.failUnlessExists('checkout/file-2')