~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/blackbox.py

  • Committer: Aaron Bentley
  • Date: 2007-12-22 02:01:03 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20071222020103-ggjszok7n974e1l2
Update branches, multi-pull to new APIs, create trees

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
import os.path
3
3
from unittest import makeSuite
4
4
 
5
 
from bzrlib import branch, osutils, workingtree
6
 
from bzrlib.config import LocationConfig
7
 
from bzrlib.transport import get_transport
8
 
from bzrlib.tests import TestCaseWithTransport, HardlinkFeature
 
5
from bzrlib import branch
 
6
from bzrlib.tests import TestCaseWithTransport
9
7
 
10
8
 
11
9
class TestBzrTools(TestCaseWithTransport):
134
132
        self.assertIs(True, 'source/subsource' in lines)
135
133
        self.assertIs(True, 'checkout/subcheckout' in lines)
136
134
        self.assertIs(True, 'checkout' not in lines)
 
135
        self.assertIs(True, 'checkout/.bzr/subcheckout' not in lines)
137
136
 
138
137
    def test_import_upstream(self):
139
138
        self.run_bzr('init source')
166
165
        self.run_bzr('import source-0.1 import5')
167
166
        self.failUnlessExists('import5/src/myfile')
168
167
 
169
 
    def test_cbranch(self):
170
 
        source = self.make_branch_and_tree('source')
171
 
        config = LocationConfig(osutils.abspath('target'))
172
 
        config.set_user_option('cbranch_target', 'target_branch')
173
 
        self.run_bzr('cbranch source target')
174
 
        checkout = workingtree.WorkingTree.open('target')
175
 
        self.assertEqual(checkout.branch.base,
176
 
                         get_transport('target').base)
177
 
        self.assertEqual(checkout.branch.get_master_branch().base,
178
 
                         get_transport('target_branch').base)
179
 
        self.assertEqual(checkout.branch.get_master_branch().get_parent(),
180
 
                         get_transport('source').base)
181
 
 
182
 
    def test_cbranch_hardlink(self):
183
 
        self.requireFeature(HardlinkFeature)
184
 
        source = self.make_branch_and_tree('source')
185
 
        self.build_tree(['source/file'])
186
 
        source.add('file')
187
 
        source.commit('added file')
188
 
        config = LocationConfig(osutils.abspath('target'))
189
 
        config.set_user_option('cbranch_target', 'target_branch')
190
 
        self.run_bzr('cbranch source target --lightweight')
191
 
        checkout = workingtree.WorkingTree.open('target')
192
 
        self.assertNotEqual(os.lstat(checkout.abspath('file')).st_ino,
193
 
                            os.lstat(source.abspath('file')).st_ino)
194
 
        config = LocationConfig(osutils.abspath('target2'))
195
 
        config.set_user_option('cbranch_target', 'target_branch2')
196
 
        self.run_bzr('cbranch source target2 --lightweight --hardlink')
197
 
        checkout2 = workingtree.WorkingTree.open('target2')
198
 
        self.assertEqual(os.lstat(checkout2.abspath('file')).st_ino,
199
 
                         os.lstat(source.abspath('file')).st_ino)
200
 
 
201
 
 
202
168
def test_suite():
203
169
    return makeSuite(TestBzrTools)