~bzr-pqm/bzr/bzr.dev

4869.4.1 by Andrew Bennetts
Add plugin for merging bzr's NEWS file to contrib/.
1
# Copyright (C) 2010 Canonical Ltd
2
#
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.
7
#
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.
12
#
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
16
6379.6.1 by Jelmer Vernooij
Import absolute_import in a few places.
17
from __future__ import absolute_import
18
5131.2.2 by Martin
Catch a couple of missed plugin module docstrings, note need for assignment to __doc__ in developer documentation and NEWS
19
__doc__ = """Merge hook for bzr's NEWS file.
4869.4.1 by Andrew Bennetts
Add plugin for merging bzr's NEWS file to contrib/.
20
4869.3.27 by Andrew Bennetts
Move news_merge plugin from contrib to bzrlib/plugins, change it to be enabled via a 'news_merge_files' config option, move more code out of the __init__ to minimise overhead, and add lots of docstrings, add NEWS entry.
21
To enable this plugin, add a section to your branch.conf or location.conf
22
like::
23
24
    [/home/user/code/bzr]
25
    news_merge_files = NEWS
26
27
The news_merge_files config option takes a list of file paths, separated by
28
commas.
29
30
Limitations:
31
32
* if there's a conflict in more than just bullet points, this doesn't yet know
33
  how to resolve that, so bzr will fallback to the default line-based merge.
4869.4.1 by Andrew Bennetts
Add plugin for merging bzr's NEWS file to contrib/.
34
"""
35
4869.3.34 by Vincent Ladeuil
Finish the patch based on reviews.
36
# Since we are a built-in plugin we share the bzrlib version
37
from bzrlib import version_info
5622.3.14 by Jelmer Vernooij
use lazy hook installation in bundled plugins.
38
from bzrlib.hooks import install_lazy_named_hook
4869.4.1 by Andrew Bennetts
Add plugin for merging bzr's NEWS file to contrib/.
39
40
4797.5.1 by Robert Collins
Support state on per-file merging to permit more efficient use of configuration data.
41
def news_merge_hook(merger):
42
    """Merger.merge_file_content hook for bzr-format NEWS files."""
5622.3.14 by Jelmer Vernooij
use lazy hook installation in bundled plugins.
43
    from bzrlib.plugins.news_merge.news_merge import NewsMerger
44
    return NewsMerger(merger)
45
46
47
install_lazy_named_hook("bzrlib.merge", "Merger.hooks", "merge_file_content",
48
    news_merge_hook, "NEWS file merge")
4869.3.34 by Vincent Ladeuil
Finish the patch based on reviews.
49
50
51
def load_tests(basic_tests, module, loader):
52
    testmod_names = [
53
        'tests',
54
        ]
55
    basic_tests.addTest(loader.loadTestsFromModuleNames(
56
            ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
57
    return basic_tests
4869.4.1 by Andrew Bennetts
Add plugin for merging bzr's NEWS file to contrib/.
58