/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2999.1.4 by Ian Clatworthy
more review tweaks including commit of blackbox tests
1
# Copyright (C) 2007 Canonical Ltd
2
# -*- coding: utf-8 -*-
3
#
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
19
"""Tests for the switch command of bzr."""
20
21
import os
22
23
from bzrlib.tests.blackbox import ExternalBase
24
25
26
class TestSwitch(ExternalBase):
27
28
    def test_switch_up_to_date_light_checkout(self):
29
        self.make_branch_and_tree('branch')
30
        self.run_bzr('branch branch branch2')
31
        self.run_bzr('checkout --lightweight branch checkout')
32
        os.chdir('checkout')
33
        out, err = self.run_bzr('switch ../branch2')
34
        self.assertContainsRe(err, 'Tree is up to date at revision 0.\n')
35
        self.assertContainsRe(err, 'Switched to branch: .*/branch2.\n')
36
        self.assertEqual('', out)
37
38
    def test_switch_out_of_date_light_checkout(self):
39
        self.make_branch_and_tree('branch')
40
        self.run_bzr('branch branch branch2')
41
        self.build_tree(['branch2/file'])
42
        self.run_bzr('add branch2/file')
43
        self.run_bzr('commit -m add-file branch2')
44
        self.run_bzr('checkout --lightweight branch checkout')
45
        os.chdir('checkout')
46
        out, err = self.run_bzr('switch ../branch2')
47
        #self.assertContainsRe(err, '\+N  file')
48
        self.assertContainsRe(err, 'Updated to revision 1.\n')
49
        self.assertContainsRe(err, 'Switched to branch: .*/branch2.\n')
50
        self.assertEqual('', out)