~ubuntu-branches/ubuntu/natty/bzr/natty-proposed

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-08-07 00:54:52 UTC
  • mfrom: (1.4.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100807005452-g4zb99ezl3xn44r4
Tags: 2.2.0-1
* New upstream release.
 + Adds support for setting timestamps to originating revisions.
   Closes: #473450
 + Removes remaining string exception. Closes: #585193, LP: #586926
 + Add C extension to work around Python issue 1628205. LP: #583941,
   Closes: #577110
 + Avoids showing progress bars when --quiet is used. Closes: #542105,
   LP: #320035
 + No longer creates ~/.bazaar as root when run under sudo. LP: #376388
 + 'bzr commit' now supports -p as alternative for --show-diff. LP: #571467
 + 'bzr add' no longer adds .THIS/.BASE/.THEIRS files unless
   explicitly requested. LP: #322767
 + When parsing patch files, Bazaar now supports diff lines before each
   patch. LP: #502076
 + WorkingTrees now no longer requires using signal.signal, so can
   be used in a threaded environment. LP: #521989
 + An assertion error is no longer triggered when pushing to a pre-1.6
   Bazaar server. LP: #528041
* Bump standards version to 3.9.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    revision as _mod_revision,
28
28
    )
29
29
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1
30
 
from bzrlib.tests.blackbox import ExternalBase
 
30
from bzrlib.tests import TestCaseWithTransport
31
31
from bzrlib.tests import (
32
32
    KnownFailure,
33
33
    HardlinkFeature,
 
34
    test_server,
34
35
    )
35
36
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
36
37
from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
37
38
from bzrlib.workingtree import WorkingTree
38
39
 
39
40
 
40
 
class TestBranch(ExternalBase):
 
41
class TestBranch(TestCaseWithTransport):
41
42
 
42
43
    def example_branch(self, path='.'):
43
44
        tree = self.make_branch_and_tree(path)
216
217
        b = branch.Branch.open('b')
217
218
        self.assertEndsWith(b.get_bound_location(), '/a/')
218
219
 
219
 
 
220
 
class TestBranchStacked(ExternalBase):
 
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
 
 
251
class TestBranchStacked(TestCaseWithTransport):
221
252
    """Tests for branch --stacked"""
222
253
 
223
254
    def assertRevisionInRepository(self, repo_path, revid):
308
339
 
309
340
    def test_branch_stacked_from_smart_server(self):
310
341
        # We can branch stacking on a smart server
311
 
        from bzrlib.smart.server import SmartTCPServer_for_testing
312
 
        self.transport_server = SmartTCPServer_for_testing
 
342
        self.transport_server = test_server.SmartTCPServer_for_testing
313
343
        trunk = self.make_branch('mainline', format='1.9')
314
344
        out, err = self.run_bzr(
315
345
            ['branch', '--stacked', self.get_url('mainline'), 'shallow'])
346
376
            err)
347
377
 
348
378
 
349
 
class TestSmartServerBranching(ExternalBase):
 
379
class TestSmartServerBranching(TestCaseWithTransport):
350
380
 
351
381
    def test_branch_from_trivial_branch_to_same_server_branch_acceptance(self):
352
382
        self.setup_smart_server_with_call_log()