/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/fastimport/cmds.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-07-28 02:47:10 UTC
  • mfrom: (7519.1.1 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200728024710-a2ylds219f1lsl62
Merge lp:brz/3.1.

Merged from https://code.launchpad.net/~jelmer/brz/merge-3.1/+merge/388173

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
"""Fastimport/fastexport commands."""
17
17
 
18
 
from __future__ import absolute_import
19
 
 
20
18
from ... import controldir
21
19
from ...commands import Command
22
20
from ...option import Option, RegistryOption
23
 
from ...sixish import (
24
 
    text_type,
25
 
    )
26
21
 
27
22
 
28
23
from . import (
41
36
    :param user_map: if not None, the file containing the user map.
42
37
    """
43
38
    from fastimport.errors import ParsingError
44
 
    from ...errors import BzrCommandError
 
39
    from ...errors import CommandError
45
40
    from fastimport import parser
46
41
    stream = _get_source_stream(source)
47
42
    user_mapper = _get_user_mapper(user_map)
50
45
    try:
51
46
        return proc.process(p.iter_commands)
52
47
    except ParsingError as e:
53
 
        raise BzrCommandError("%d: Parse error: %s" % (e.lineno, e))
 
48
        raise CommandError("%d: Parse error: %s" % (e.lineno, e))
54
49
 
55
50
 
56
51
def _get_source_stream(source):
242
237
    _see_also = ['fast-export', 'fast-import-filter', 'fast-import-info']
243
238
    takes_args = ['source', 'destination?']
244
239
    takes_options = ['verbose',
245
 
                     Option('user-map', type=text_type,
 
240
                     Option('user-map', type=str,
246
241
                            help="Path to file containing a map of user-ids.",
247
242
                            ),
248
 
                     Option('info', type=text_type,
 
243
                     Option('info', type=str,
249
244
                            help="Path to file containing caching hints.",
250
245
                            ),
251
246
                     Option('trees',
271
266
                                                experimental="Enable experimental features.",
272
267
                                                value_switches=True, enum_switch=False,
273
268
                                                ),
274
 
                     Option('import-marks', type=text_type,
 
269
                     Option('import-marks', type=str,
275
270
                            help="Import marks from file."
276
271
                            ),
277
 
                     Option('export-marks', type=text_type,
 
272
                     Option('export-marks', type=str,
278
273
                            help="Export marks to file."
279
274
                            ),
280
275
                     RegistryOption('format',
322
317
                    user_map=user_map)
323
318
 
324
319
    def _generate_info(self, source):
325
 
        from ...sixish import StringIO
 
320
        from io import StringIO
326
321
        from fastimport import parser
327
322
        from fastimport.errors import ParsingError
328
 
        from ...errors import BzrCommandError
 
323
        from ...errors import CommandError
329
324
        from fastimport.processors import info_processor
330
325
        stream = _get_source_stream(source)
331
326
        output = StringIO()
335
330
            try:
336
331
                return_code = proc.process(p.iter_commands)
337
332
            except ParsingError as e:
338
 
                raise BzrCommandError("%d: Parse error: %s" % (e.lineno, e))
 
333
                raise CommandError("%d: Parse error: %s" % (e.lineno, e))
339
334
            lines = output.getvalue().splitlines()
340
335
        finally:
341
336
            output.close()
448
443
    _see_also = ['fast-import', 'fast-import-filter']
449
444
    takes_args = ['source?', 'destination?']
450
445
    takes_options = ['verbose', 'revision',
451
 
                     Option('git-branch', short_name='b', type=text_type,
 
446
                     Option('git-branch', short_name='b', type=str,
452
447
                            argname='FILE',
453
448
                            help='Name of the git branch to create (default=master).'
454
449
                            ),
455
450
                     Option('checkpoint', type=int, argname='N',
456
451
                            help="Checkpoint every N revisions (default=10000)."
457
452
                            ),
458
 
                     Option('marks', type=text_type, argname='FILE',
 
453
                     Option('marks', type=str, argname='FILE',
459
454
                            help="Import marks from and export marks to file."
460
455
                            ),
461
 
                     Option('import-marks', type=text_type, argname='FILE',
 
456
                     Option('import-marks', type=str, argname='FILE',
462
457
                            help="Import marks from file."
463
458
                            ),
464
 
                     Option('export-marks', type=text_type, argname='FILE',
 
459
                     Option('export-marks', type=str, argname='FILE',
465
460
                            help="Export marks to file."
466
461
                            ),
467
462
                     Option('plain',