32
32
how to resolve that, so bzr will fallback to the default line-based merge.
35
# Since we are a built-in plugin we share the bzrlib version
36
from bzrlib import version_info
35
38
# Put most of the code in a separate module that we lazy-import to keep the
36
39
# overhead of this plugin as minimal as possible.
37
40
from bzrlib.lazy_import import lazy_import
61
64
def filename_matches_config(params):
62
config = params.merger.this_branch.get_config()
63
affected_files = config.get_user_option_as_list('news_merge_files')
65
affected_files = getattr(params, '_news_merge_affected_files', None)
66
if affected_files is None:
67
config = params.merger.this_tree.branch.get_config()
68
# Until bzr provides a better policy for caching the config, we just
69
# add the part we're interested in to the params to avoid reading the
70
# config files repeatedly (bazaar.conf, location.conf, branch.conf).
71
affected_files = config.get_user_option_as_list('news_merge_files')
72
if affected_files is None:
73
# If nothing was specified in the config, we have nothing to do,
74
# but we use None in the params to start the caching.
76
params._news_merge_affected_files = affected_files
65
78
filename = params.merger.this_tree.id2path(params.file_id)
66
79
if filename in affected_files:
71
Merger.hooks.install_named_hook(
72
'merge_file_content', news_merge_hook, 'NEWS file merge')
84
Merger.hooks.install_named_hook(
85
'merge_file_content', news_merge_hook, 'NEWS file merge')
89
def load_tests(basic_tests, module, loader):
93
basic_tests.addTest(loader.loadTestsFromModuleNames(
94
["%s.%s" % (__name__, tmn) for tmn in testmod_names]))