~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/test_switch.py

  • Committer: Aaron Bentley
  • Date: 2007-11-14 13:51:00 UTC
  • Revision ID: abentley@panoramicfeedback.com-20071114135100-4nl2zzm8zfg0e2cu
Fix handling of heavyweight checkouts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import os
2
2
 
3
 
from bzrlib import branch, tests
 
3
from bzrlib import branch, errors, tests
4
4
 
5
5
from bzrlib.plugins.bzrtools.switch import switch
6
6
 
44
44
        self.failUnlessExists('checkout/file-1')
45
45
        self.failIfExists('checkout/file-2')
46
46
        self.failUnlessExists('checkout/file-3')
 
47
 
 
48
    def test_switch_heavy_checkout(self):
 
49
        tree = self.make_branch_and_tree('branch-1')
 
50
        self.build_tree(['branch-1/file-1'])
 
51
        tree.add('file-1')
 
52
        tree.commit('rev1')
 
53
        tree.branch.create_checkout('checkout-1', lightweight=False)
 
54
        branch2 = self.make_branch('branch-2')
 
55
        err = self.assertRaises(errors.BzrCommandError,
 
56
                                switch, tree.bzrdir, branch2)
 
57
        self.assertContainsRe(str(err),
 
58
            "The switch command can only be used on a light checkout")