~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-17 13:49:11 UTC
  • mfrom: (4988.11.1 imports)
  • Revision ID: pqm@pqm.ubuntu.com-20100217134911-s77se00ni7xc1hz8
(Jelmer) Remove some unused imports.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
28
28
    errors,
29
29
    workingtree,
30
30
    )
31
 
from bzrlib.tests import (
32
 
    TestCaseWithTransport,
 
31
from bzrlib.tests.blackbox import (
 
32
    ExternalBase,
33
33
    )
34
34
from bzrlib.tests import (
 
35
    HardlinkFeature,
35
36
    KnownFailure,
36
37
    )
37
 
from bzrlib.tests.features import (
38
 
    HardlinkFeature,
39
 
    )
40
 
 
41
 
 
42
 
class TestCheckout(TestCaseWithTransport):
 
38
 
 
39
 
 
40
class TestCheckout(ExternalBase):
43
41
 
44
42
    def setUp(self):
45
43
        super(TestCheckout, self).setUp()
66
64
                         result.open_branch().bzrdir.root_transport.base)
67
65
 
68
66
    def test_checkout_dash_r(self):
69
 
        out, err = self.run_bzr(['checkout', '-r', '-2', 'branch', 'checkout'])
 
67
        self.run_bzr('checkout -r -2 branch checkout')
70
68
        # the working tree should now be at revision '1' with the content
71
69
        # from 1.
72
70
        result = bzrdir.BzrDir.open('checkout')
73
71
        self.assertEqual(['1'], result.open_workingtree().get_parent_ids())
74
 
        self.assertPathDoesNotExist('checkout/added_in_2')
 
72
        self.failIfExists('checkout/added_in_2')
75
73
 
76
74
    def test_checkout_light_dash_r(self):
77
 
        out, err = self.run_bzr(['checkout','--lightweight', '-r', '-2',
78
 
            'branch', 'checkout'])
 
75
        self.run_bzr('checkout --lightweight -r -2 branch checkout')
79
76
        # the working tree should now be at revision '1' with the content
80
77
        # from 1.
81
78
        result = bzrdir.BzrDir.open('checkout')
82
79
        self.assertEqual(['1'], result.open_workingtree().get_parent_ids())
83
 
        self.assertPathDoesNotExist('checkout/added_in_2')
 
80
        self.failIfExists('checkout/added_in_2')
84
81
 
85
82
    def test_checkout_reconstitutes_working_trees(self):
86
83
        # doing a 'bzr checkout' in the directory of a branch with no tree
126
123
            cmd.append('--lightweight')
127
124
        self.run_bzr('checkout source target')
128
125
        # files with unique content should be moved
129
 
        self.assertPathExists('target/file2.moved')
 
126
        self.failUnlessExists('target/file2.moved')
130
127
        # files with content matching tree should not be moved
131
 
        self.assertPathDoesNotExist('target/file1.moved')
 
128
        self.failIfExists('target/file1.moved')
132
129
 
133
130
    def test_checkout_existing_dir_heavy(self):
134
131
        self._test_checkout_existing_dir(False)
158
155
        self.build_tree(['source/file1'])
159
156
        source.add('file1')
160
157
        source.commit('added file')
161
 
        out, err = self.run_bzr('checkout source target --hardlink')
 
158
        out, err = self.run_bzr(['checkout', 'source', 'target',
 
159
            '--files-from', 'source',
 
160
            '--hardlink'])
162
161
        source_stat = os.stat('source/file1')
163
162
        target_stat = os.stat('target/file1')
164
163
        self.assertEqual(source_stat, target_stat)
165
 
 
166
 
    def test_checkout_hardlink_files_from(self):
167
 
        self.requireFeature(HardlinkFeature)
168
 
        source = self.make_branch_and_tree('source')
169
 
        self.build_tree(['source/file1'])
170
 
        source.add('file1')
171
 
        source.commit('added file')
172
 
        source.bzrdir.sprout('second')
173
 
        out, err = self.run_bzr('checkout source target --hardlink'
174
 
                                ' --files-from second')
175
 
        second_stat = os.stat('second/file1')
176
 
        target_stat = os.stat('target/file1')
177
 
        self.assertEqual(second_stat, target_stat)