~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export_pot.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
is also left to that stage of the process.
27
27
"""
28
28
 
 
29
from __future__ import absolute_import
 
30
 
29
31
import inspect
30
32
import os
31
33
 
130
132
class _PotExporter(object):
131
133
    """Write message details to output stream in .pot file format"""
132
134
 
133
 
    def __init__(self, outf):
 
135
    def __init__(self, outf, include_duplicates=False):
134
136
        self.outf = outf
135
 
        self._msgids = set()
 
137
        if include_duplicates:
 
138
            self._msgids = None
 
139
        else:
 
140
            self._msgids = set()
136
141
        self._module_contexts = {}
137
142
 
138
143
    def poentry(self, path, lineno, s, comment=None):
139
 
        if s in self._msgids:
140
 
            return
141
 
        self._msgids.add(s)
 
144
        if self._msgids is not None:
 
145
            if s in self._msgids:
 
146
                return
 
147
            self._msgids.add(s)
142
148
        if comment is None:
143
149
            comment = ''
144
150
        else:
305
311
                     1, summary)
306
312
 
307
313
 
308
 
def export_pot(outf, plugin=None):
309
 
    exporter = _PotExporter(outf)
 
314
def export_pot(outf, plugin=None, include_duplicates=False):
 
315
    exporter = _PotExporter(outf, include_duplicates)
310
316
    if plugin is None:
311
317
        _standard_options(exporter)
312
318
        _command_helps(exporter)