1
# Copyright (C) 2007 Canonical Ltd
2
# -*- coding: utf-8 -*-
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.
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.
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
19
"""Tests for the switch command of bzr."""
23
from bzrlib.tests.blackbox import ExternalBase
26
class TestSwitch(ExternalBase):
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')
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)
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')
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)