~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008, 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
31
31
from bzrlib.tests import (
32
32
    KnownFailure,
33
33
    HardlinkFeature,
34
 
    test_server,
35
34
    )
36
35
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
37
36
from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
217
216
        b = branch.Branch.open('b')
218
217
        self.assertEndsWith(b.get_bound_location(), '/a/')
219
218
 
220
 
    def test_branch_with_post_branch_init_hook(self):
221
 
        calls = []
222
 
        branch.Branch.hooks.install_named_hook('post_branch_init',
223
 
            calls.append, None)
224
 
        self.assertLength(0, calls)
225
 
        self.example_branch('a')
226
 
        self.assertLength(1, calls)
227
 
        self.run_bzr('branch a b')
228
 
        self.assertLength(2, calls)
229
 
 
230
 
    def test_checkout_with_post_branch_init_hook(self):
231
 
        calls = []
232
 
        branch.Branch.hooks.install_named_hook('post_branch_init',
233
 
            calls.append, None)
234
 
        self.assertLength(0, calls)
235
 
        self.example_branch('a')
236
 
        self.assertLength(1, calls)
237
 
        self.run_bzr('checkout a b')
238
 
        self.assertLength(2, calls)
239
 
 
240
 
    def test_lightweight_checkout_with_post_branch_init_hook(self):
241
 
        calls = []
242
 
        branch.Branch.hooks.install_named_hook('post_branch_init',
243
 
            calls.append, None)
244
 
        self.assertLength(0, calls)
245
 
        self.example_branch('a')
246
 
        self.assertLength(1, calls)
247
 
        self.run_bzr('checkout --lightweight a b')
248
 
        self.assertLength(2, calls)
249
 
 
250
219
 
251
220
class TestBranchStacked(ExternalBase):
252
221
    """Tests for branch --stacked"""
339
308
 
340
309
    def test_branch_stacked_from_smart_server(self):
341
310
        # We can branch stacking on a smart server
342
 
        self.transport_server = test_server.SmartTCPServer_for_testing
 
311
        from bzrlib.smart.server import SmartTCPServer_for_testing
 
312
        self.transport_server = SmartTCPServer_for_testing
343
313
        trunk = self.make_branch('mainline', format='1.9')
344
314
        out, err = self.run_bzr(
345
315
            ['branch', '--stacked', self.get_url('mainline'), 'shallow'])
355
325
            '  Packs 5 (adds stacking support, requires bzr 1.6)\n'
356
326
            'Source branch format does not support stacking, using format:\n'
357
327
            '  Branch format 7\n'
358
 
            'Doing on-the-fly conversion from RepositoryFormatKnitPack1() to RepositoryFormatKnitPack5().\n'
359
 
            'This may take some time. Upgrade the repositories to the same format for better performance.\n'
360
328
            'Created new stacked branch referring to %s.\n' % (trunk.base,),
361
329
            err)
362
330
 
370
338
            '  Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)\n'
371
339
            'Source branch format does not support stacking, using format:\n'
372
340
            '  Branch format 7\n'
373
 
            'Doing on-the-fly conversion from RepositoryFormatKnitPack4() to RepositoryFormatKnitPack5RichRoot().\n'
374
 
            'This may take some time. Upgrade the repositories to the same format for better performance.\n'
375
341
            'Created new stacked branch referring to %s.\n' % (trunk.base,),
376
342
            err)
377
343