1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2005, 2006, 2008, 2009 Canonical Ltd
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
217
216
b = branch.Branch.open('b')
218
217
self.assertEndsWith(b.get_bound_location(), '/a/')
220
def test_branch_with_post_branch_init_hook(self):
222
branch.Branch.hooks.install_named_hook('post_branch_init',
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)
230
def test_checkout_with_post_branch_init_hook(self):
232
branch.Branch.hooks.install_named_hook('post_branch_init',
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)
240
def test_lightweight_checkout_with_post_branch_init_hook(self):
242
branch.Branch.hooks.install_named_hook('post_branch_init',
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)
251
220
class TestBranchStacked(ExternalBase):
252
221
"""Tests for branch --stacked"""
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,),
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,),