/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_stacking.py

  • Committer: Andrew Bennetts
  • Date: 2008-10-27 06:14:45 UTC
  • mfrom: (3793 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3795.
  • Revision ID: andrew.bennetts@canonical.com-20081027061445-eqt9lz6uw1mbvq4g
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for Branch.get_stacked_on_url and set_stacked_on_url."""
18
18
 
19
19
from bzrlib import (
 
20
    branch,
20
21
    bzrdir,
21
22
    errors,
22
23
    )
336
337
        rtree.lock_read()
337
338
        self.addCleanup(rtree.unlock)
338
339
        self.assertEqual('new content', rtree.get_file_by_path('a').read())
 
340
 
 
341
    def test_transform_fallback_location_hook(self):
 
342
        # The 'transform_fallback_location' branch hook allows us to inspect
 
343
        # and transform the URL of the fallback location for the branch.
 
344
        stack_on = self.make_branch('stack-on')
 
345
        stacked = self.make_branch('stacked')
 
346
        try:
 
347
            stacked.set_stacked_on_url('../stack-on')
 
348
        except (errors.UnstackableRepositoryFormat,
 
349
                errors.UnstackableBranchFormat):
 
350
            raise TestNotApplicable('Format does not support stacking.')
 
351
        self.get_transport().rename('stack-on', 'new-stack-on')
 
352
        hook_calls = []
 
353
        def hook(stacked_branch, url):
 
354
            hook_calls.append(url)
 
355
            return '../new-stack-on'
 
356
        branch.Branch.hooks.install_named_hook(
 
357
            'transform_fallback_location', hook, None)
 
358
        branch.Branch.open('stacked')
 
359
        self.assertEqual(['../stack-on'], hook_calls)