~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2005-11-04 01:46:31 UTC
  • mto: (1185.33.49 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1512.
  • Revision ID: mbp@sourcefrog.net-20051104014631-750e0ad4172c952c
Make biobench directly executable

Show diffs side-by-side

added added

removed removed

Lines of Context:
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)