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
210
209
self.assertEqual('', out)
211
210
self.assertEqual('bzr: ERROR: Already a branch: "b".\n', err)
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/')
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
213
class TestBranchStacked(ExternalBase):
252
214
"""Tests for branch --stacked"""
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,),
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,),