1
# Copyright (C) 2010 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
"""Merge hook for bzr's NEWS file.
19
To enable this plugin, add a section to your branch.conf or location.conf
23
news_merge_files = NEWS
24
news_merge_files:policy = recurse
26
The news_merge_files config option takes a list of file paths, separated by
31
* if there's a conflict in more than just bullet points, this doesn't yet know
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
38
# Put most of the code in a separate module that we lazy-import to keep the
39
# overhead of this plugin as minimal as possible.
40
from bzrlib.lazy_import import lazy_import
41
lazy_import(globals(), """
42
from bzrlib.plugins.news_merge import news_merge as _mod_news_merge
45
from bzrlib.merge import Merger
48
def news_merge_hook(merger):
49
"""Merger.merge_file_content hook for bzr-format NEWS files."""
50
return _mod_news_merge.NewsMerger(merger)
54
Merger.hooks.install_named_hook(
55
'merge_file_content', news_merge_hook, 'NEWS file merge')
59
def load_tests(basic_tests, module, loader):
63
basic_tests.addTest(loader.loadTestsFromModuleNames(
64
["%s.%s" % (__name__, tmn) for tmn in testmod_names]))