Rev 6323: (vila) Smarter .po file merging with merge hook as a plugin: po_merge in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Tue Nov 29 11:13:07 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6323 [merge]
revision-id: pqm at pqm.ubuntu.com-20111129111307-5aj61u7nfe43cla7
parent: pqm at pqm.ubuntu.com-20111129104747-32qen0v8yxbxeoov
parent: v.ladeuil+lp at free.fr-20111129104303-s556m163ckcbhd1g
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-11-29 11:13:07 +0000
message:
  (vila) Smarter .po file merging with merge hook as a plugin: po_merge
   (lazy options). (Vincent Ladeuil)
modified:
  bzrlib/plugins/po_merge/__init__.py __init__.py-20111123180440-la918t6t068pzacx-3
  bzrlib/plugins/po_merge/po_merge.py po_merge.py-20111123180440-la918t6t068pzacx-4
=== modified file 'bzrlib/plugins/po_merge/__init__.py'
--- a/bzrlib/plugins/po_merge/__init__.py	2011-11-29 10:21:18 +0000
+++ b/bzrlib/plugins/po_merge/__init__.py	2011-11-29 10:41:36 +0000
@@ -59,38 +59,15 @@
 from bzrlib.hooks import install_lazy_named_hook
 
 
-config.option_registry.register(config.Option(
-        'po_merge.command',
-        default='msgmerge -N "{other}" "{pot_file}" -C "{this}" -o "{result}"',
-        help='''\
-Command used to create a conflict-free .po file during merge.
-
-The following parameters are provided by the hook:
-``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.
-``result`` is the path where ``msgmerge`` will output its result. The hook will
-use the content of this file to produce the resulting ``.po`` file.
-
-The command is invoked at the root of the working tree so all paths are
-relative.
-'''))
-
-
-config.option_registry.register(config.Option(
-        'po_merge.po_dirs', default='po,debian/po',
-        from_unicode=config.list_from_store,
-        help='List of dirs containing .po files that the hook applies to.'))
-
-
-config.option_registry.register(config.Option(
-        'po_merge.po_glob', default='*.po',
-        help='Glob matching all ``.po`` files in one of ``po_merge.po_dirs``.'))
-
-config.option_registry.register(config.Option(
-        'po_merge.pot_glob', default='*.pot',
-        help='Glob matching the ``.pot`` file in one of ``po_merge.po_dirs``.'))
+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):

=== modified file 'bzrlib/plugins/po_merge/po_merge.py'
--- a/bzrlib/plugins/po_merge/po_merge.py	2011-11-29 10:21:18 +0000
+++ b/bzrlib/plugins/po_merge/po_merge.py	2011-11-29 10:41:36 +0000
@@ -38,6 +38,39 @@
 """)
 
 
+command_option = config.Option(
+        'po_merge.command',
+        default='msgmerge -N "{other}" "{pot_file}" -C "{this}" -o "{result}"',
+        help='''\
+Command used to create a conflict-free .po file during merge.
+
+The following parameters are provided by the hook:
+``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.
+``result`` is the path where ``msgmerge`` will output its result. The hook will
+use the content of this file to produce the resulting ``.po`` file.
+
+All paths are absolute.
+''')
+
+
+po_dirs_option = config.Option(
+        'po_merge.po_dirs', default='po,debian/po',
+        from_unicode=config.list_from_store,
+        help='List of dirs containing .po files that the hook applies to.')
+
+
+po_glob_option = config.Option(
+        'po_merge.po_glob', default='*.po',
+        help='Glob matching all ``.po`` files in one of ``po_merge.po_dirs``.')
+
+pot_glob_option = config.Option(
+        'po_merge.pot_glob', default='*.pot',
+        help='Glob matching the ``.pot`` file in one of ``po_merge.po_dirs``.')
+
+
 class PoMerger(merge.PerFileMerger):
     """Merge .po files."""
 




More information about the bazaar-commits mailing list