/usr/lib/python2.7/dist-packages/bzrlib/plugins/po_merge/__init__.py is in python-bzrlib 2.7.0-2ubuntu3.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | # Copyright (C) 2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
from __future__ import absolute_import
__doc__ = """Merge hook for ``.po`` files.
To enable this plugin, add a section to your branch.conf or location.conf
like::
[/home/user/code/bzr]
po_merge.pot_dirs = po,doc/po4a/po
The ``po_merge.pot_dirs`` config option takes a list of directories that can
contain ``.po`` files, separated by commas (if several directories are
needed). Each directory should contain a single ``.pot`` file.
The ``po_merge.command`` is the command whose output is used as the result of
the merge. It defaults to::
msgmerge -N "{other}" "{pot_file}" -C "{this}" -o "{result}"
where:
* ``this`` is the ``.po`` file content before the merge in the current branch,
* ``other`` is the ``.po`` file content in the branch merged from,
* ``pot_file`` is the path to the ``.pot`` file corresponding to the ``.po``
file being merged.
If conflicts occur in a ``.pot`` file during a given merge, the ``.po`` files
will use the ``.pot`` file present in tree before the merge. If this doesn't
suit your needs, you should can disable the plugin during the merge with::
bzr merge <usual merge args> -Opo_merge.po_dirs=
This will allow you to resolve the conflicts in the ``.pot`` file and then
merge the ``.po`` files again with::
bzr remerge po/*.po doc/po4a/po/*.po
"""
from bzrlib import (
config,
# Since we are a built-in plugin we share the bzrlib version
version_info,
)
from bzrlib.hooks import install_lazy_named_hook
def register_lazy_option(key, member):
config.option_registry.register_lazy(
key, 'bzrlib.plugins.po_merge.po_merge', member)
register_lazy_option('po_merge.command', 'command_option')
register_lazy_option('po_merge.po_dirs', 'po_dirs_option')
register_lazy_option('po_merge.po_glob', 'po_glob_option')
register_lazy_option('po_merge.pot_glob', 'pot_glob_option')
def po_merge_hook(merger):
"""Merger.merge_file_content hook for po files."""
from bzrlib.plugins.po_merge.po_merge import PoMerger
return PoMerger(merger)
install_lazy_named_hook("bzrlib.merge", "Merger.hooks", "merge_file_content",
po_merge_hook, ".po file merge")
def load_tests(basic_tests, module, loader):
testmod_names = [
'tests',
]
basic_tests.addTest(loader.loadTestsFromModuleNames(
["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
return basic_tests
|