~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_switch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-29 22:03:03 UTC
  • mfrom: (5416.2.6 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100929220303-cr95h8iwtggco721
(mbp) Add 'break-lock --force'

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import os
21
21
 
22
 
from bzrlib import branch, errors, switch, tests
 
22
from bzrlib import (
 
23
    branch,
 
24
    errors,
 
25
    merge as _mod_merge,
 
26
    switch,
 
27
    tests,
 
28
)
23
29
 
24
30
 
25
31
class TestSwitch(tests.TestCaseWithTransport):
129
135
        switch.switch(checkout.bzrdir, tree2.branch)
130
136
        self.assertEqual('custom-root-id', tree2.get_root_id())
131
137
 
 
138
    def test_switch_configurable_file_merger(self):
 
139
        class DummyMerger(_mod_merge.ConfigurableFileMerger):
 
140
            name_prefix = 'file'
 
141
 
 
142
        _mod_merge.Merger.hooks.install_named_hook(
 
143
            'merge_file_content', DummyMerger,
 
144
            'test factory')
 
145
        foo = self.make_branch('foo')
 
146
        checkout = foo.create_checkout('checkout', lightweight=True)
 
147
        self.build_tree_contents([('checkout/file', 'a')])
 
148
        checkout.add('file')
 
149
        checkout.commit('a')
 
150
        bar = foo.bzrdir.sprout('bar').open_workingtree()
 
151
        self.build_tree_contents([('bar/file', 'b')])
 
152
        bar.commit('b')
 
153
        self.build_tree_contents([('checkout/file', 'c')])
 
154
        switch.switch(checkout.bzrdir, bar.branch)
 
155
 
132
156
 
133
157
class TestSwitchHeavyweight(TestSwitch):
134
158