~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2005-05-09 03:03:55 UTC
  • Revision ID: mbp@sourcefrog.net-20050509030355-ad6ab558d1362959
- Don't give an error if the trace file can't be opened

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by 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
 
"""Tests for the 'checkout' CLI command."""
19
 
 
20
 
from cStringIO import StringIO
21
 
import os
22
 
import re
23
 
import shutil
24
 
import sys
25
 
 
26
 
import bzrlib.bzrdir as bzrdir
27
 
from bzrlib.tests.blackbox import ExternalBase
28
 
 
29
 
 
30
 
class TestCheckout(ExternalBase):
31
 
    
32
 
    def setUp(self):
33
 
        super(TestCheckout, self).setUp()
34
 
        tree = bzrdir.BzrDir.create_standalone_workingtree('branch')
35
 
        tree.commit('1', rev_id='1', allow_pointless=True)
36
 
        self.build_tree(['branch/added_in_2'])
37
 
        tree.add('added_in_2')
38
 
        tree.commit('2', rev_id='2')
39
 
 
40
 
    def test_checkout_makes_bound_branch(self):
41
 
        self.runbzr('checkout branch checkout')
42
 
        # if we have a checkout, the branch base should be 'branch'
43
 
        source = bzrdir.BzrDir.open('branch')
44
 
        result = bzrdir.BzrDir.open('checkout')
45
 
        self.assertEqual(source.open_branch().bzrdir.root_transport.base,
46
 
                         result.open_branch().get_bound_location())
47
 
 
48
 
    def test_checkout_light_makes_checkout(self):
49
 
        self.runbzr('checkout --lightweight branch checkout')
50
 
        # if we have a checkout, the branch base should be 'branch'
51
 
        source = bzrdir.BzrDir.open('branch')
52
 
        result = bzrdir.BzrDir.open('checkout')
53
 
        self.assertEqual(source.open_branch().bzrdir.root_transport.base,
54
 
                         result.open_branch().bzrdir.root_transport.base)
55
 
 
56
 
    def test_checkout_dash_r(self):
57
 
        self.runbzr('checkout -r -2 branch checkout')
58
 
        # the working tree should now be at revision '1' with the content
59
 
        # from 1.
60
 
        result = bzrdir.BzrDir.open('checkout')
61
 
        self.assertEqual('1', result.open_workingtree().last_revision())
62
 
        self.failIfExists('checkout/added_in_2')
63
 
 
64
 
    def test_checkout_light_dash_r(self):
65
 
        self.runbzr('checkout --lightweight -r -2 branch checkout')
66
 
        # the working tree should now be at revision '1' with the content
67
 
        # from 1.
68
 
        result = bzrdir.BzrDir.open('checkout')
69
 
        self.assertEqual('1', result.open_workingtree().last_revision())
70
 
        self.failIfExists('checkout/added_in_2')
71