~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Add a NEWS entry and prepare submission.

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
210
209
        self.assertEqual('', out)
211
210
        self.assertEqual('bzr: ERROR: Already a branch: "b".\n', err)
212
211
 
213
 
    def test_branch_bind(self):
214
 
        self.example_branch('a')
215
 
        out, err = self.run_bzr('branch a b --bind')
216
 
        self.assertEndsWith(err, "New branch bound to a\n")
217
 
        b = branch.Branch.open('b')
218
 
        self.assertEndsWith(b.get_bound_location(), '/a/')
219
 
 
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
212
 
251
213
class TestBranchStacked(ExternalBase):
252
214
    """Tests for branch --stacked"""
339
301
 
340
302
    def test_branch_stacked_from_smart_server(self):
341
303
        # We can branch stacking on a smart server
342
 
        self.transport_server = test_server.SmartTCPServer_for_testing
 
304
        from bzrlib.smart.server import SmartTCPServer_for_testing
 
305
        self.transport_server = SmartTCPServer_for_testing
343
306
        trunk = self.make_branch('mainline', format='1.9')
344
307
        out, err = self.run_bzr(
345
308
            ['branch', '--stacked', self.get_url('mainline'), 'shallow'])
355
318
            '  Packs 5 (adds stacking support, requires bzr 1.6)\n'
356
319
            'Source branch format does not support stacking, using format:\n'
357
320
            '  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
321
            'Created new stacked branch referring to %s.\n' % (trunk.base,),
361
322
            err)
362
323
 
370
331
            '  Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)\n'
371
332
            'Source branch format does not support stacking, using format:\n'
372
333
            '  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
334
            'Created new stacked branch referring to %s.\n' % (trunk.base,),
376
335
            err)
377
336