33
33
from bzrlib.errors import UnrelatedBranches, NoCommits
34
34
from bzrlib.merge import transform_tree, merge_inner, _PlanMerge
35
35
from bzrlib.osutils import pathjoin, file_kind
36
from bzrlib.tests import TestCaseWithTransport, TestCaseWithMemoryTransport
36
from bzrlib.tests import (
37
TestCaseWithMemoryTransport,
38
TestCaseWithTransport,
37
41
from bzrlib.workingtree import WorkingTree
2833
2837
'bval', ['lca1val', 'lca2val', 'lca2val'], 'oval', 'tval')
2834
2838
self.assertLCAMultiWay('conflict',
2835
2839
'bval', ['lca1val', 'lca2val', 'lca3val'], 'oval', 'tval')
2842
class TestConfigurableFileMerger(tests.TestCaseWithTransport):
2844
def test_affected_files_cached(self):
2845
"""Ensures that the config variable is cached"""
2846
class SimplePlan(_mod_merge.ConfigurableFileMerger):
2847
def merge_text(self, params):
2848
return ('not applicable', None)
2849
def factory(merger):
2850
result = SimplePlan(merger, "foo", ["my default"])
2851
self.assertEqual(None, result.affected_files)
2852
self.merger = result
2854
_mod_merge.Merger.hooks.install_named_hook('merge_file_content',
2855
factory, 'test factory')
2856
builder = test_merge_core.MergeBuilder(self.test_base_dir)
2857
self.addCleanup(builder.cleanup)
2858
builder.add_file('NEWS', builder.tree_root, 'name1', 'text1', True)
2859
builder.change_contents('NEWS', other='text4', this='text3')
2860
conflicts = builder.merge()
2861
# The hook should set the variable
2862
self.assertEqual(["my default"], self.merger.affected_files)