242
242
_see_also = ['fast-export', 'fast-import-filter', 'fast-import-info']
243
243
takes_args = ['source', 'destination?']
244
244
takes_options = ['verbose',
245
Option('user-map', type=text_type,
246
help="Path to file containing a map of user-ids.",
248
Option('info', type=text_type,
249
help="Path to file containing caching hints.",
252
help="Update all working trees, not just trunk's.",
254
Option('count', type=int,
255
help="Import this many revisions then exit.",
257
Option('checkpoint', type=int,
258
help="Checkpoint automatically every N revisions."
259
" The default is 10000.",
261
Option('autopack', type=int,
262
help="Pack every N checkpoints. The default is 4.",
264
Option('inv-cache', type=int,
265
help="Number of inventories to cache.",
267
RegistryOption.from_kwargs('mode',
268
'The import algorithm to use.',
269
title='Import Algorithm',
270
default='Use the preferred algorithm (inventory deltas).',
271
experimental="Enable experimental features.",
272
value_switches=True, enum_switch=False,
274
Option('import-marks', type=text_type,
275
help="Import marks from file."
277
Option('export-marks', type=text_type,
278
help="Export marks to file."
280
RegistryOption('format',
281
help='Specify a format for the created repository. See'
282
' "bzr help formats" for details.',
283
lazy_registry=('breezy.controldir', 'format_registry'),
284
converter=lambda name: controldir.format_registry.make_controldir(name),
285
value_switches=False, title='Repository format'),
245
Option('user-map', type=text_type,
246
help="Path to file containing a map of user-ids.",
248
Option('info', type=text_type,
249
help="Path to file containing caching hints.",
252
help="Update all working trees, not just trunk's.",
254
Option('count', type=int,
255
help="Import this many revisions then exit.",
257
Option('checkpoint', type=int,
258
help="Checkpoint automatically every N revisions."
259
" The default is 10000.",
261
Option('autopack', type=int,
262
help="Pack every N checkpoints. The default is 4.",
264
Option('inv-cache', type=int,
265
help="Number of inventories to cache.",
267
RegistryOption.from_kwargs('mode',
268
'The import algorithm to use.',
269
title='Import Algorithm',
270
default='Use the preferred algorithm (inventory deltas).',
271
experimental="Enable experimental features.",
272
value_switches=True, enum_switch=False,
274
Option('import-marks', type=text_type,
275
help="Import marks from file."
277
Option('export-marks', type=text_type,
278
help="Export marks to file."
280
RegistryOption('format',
281
help='Specify a format for the created repository. See'
282
' "bzr help formats" for details.',
284
'breezy.controldir', 'format_registry'),
285
converter=lambda name: controldir.format_registry.make_controldir(
287
value_switches=False, title='Repository format'),
287
290
def run(self, source, destination='.', verbose=False, info=None,
288
trees=False, count=-1, checkpoint=10000, autopack=4, inv_cache=-1,
289
mode=None, import_marks=None, export_marks=None, format=None,
291
trees=False, count=-1, checkpoint=10000, autopack=4, inv_cache=-1,
292
mode=None, import_marks=None, export_marks=None, format=None,
291
294
load_fastimport()
292
295
from .processors import generic_processor
293
296
from .helpers import (
445
448
_see_also = ['fast-import', 'fast-import-filter']
446
449
takes_args = ['source?', 'destination?']
447
450
takes_options = ['verbose', 'revision',
448
Option('git-branch', short_name='b', type=text_type,
450
help='Name of the git branch to create (default=master).'
452
Option('checkpoint', type=int, argname='N',
453
help="Checkpoint every N revisions (default=10000)."
455
Option('marks', type=text_type, argname='FILE',
456
help="Import marks from and export marks to file."
458
Option('import-marks', type=text_type, argname='FILE',
459
help="Import marks from file."
461
Option('export-marks', type=text_type, argname='FILE',
462
help="Export marks to file."
465
help="Exclude metadata to maximise interoperability."
467
Option('rewrite-tag-names',
468
help="Replace characters invalid in git with '_'"
469
" (plain mode only).",
472
help="Export an 'absolute' baseline commit prior to"
473
"the first relative commit",
476
help="Don't export tags"
451
Option('git-branch', short_name='b', type=text_type,
453
help='Name of the git branch to create (default=master).'
455
Option('checkpoint', type=int, argname='N',
456
help="Checkpoint every N revisions (default=10000)."
458
Option('marks', type=text_type, argname='FILE',
459
help="Import marks from and export marks to file."
461
Option('import-marks', type=text_type, argname='FILE',
462
help="Import marks from file."
464
Option('export-marks', type=text_type, argname='FILE',
465
help="Export marks to file."
468
help="Exclude metadata to maximise interoperability."
470
Option('rewrite-tag-names',
471
help="Replace characters invalid in git with '_'"
472
" (plain mode only).",
475
help="Export an 'absolute' baseline commit prior to"
476
"the first relative commit",
479
help="Don't export tags"
479
482
encoding_type = 'exact'
480
484
def run(self, source=None, destination=None, verbose=False,
481
git_branch="master", checkpoint=10000, marks=None,
482
import_marks=None, export_marks=None, revision=None,
483
plain=True, rewrite_tag_names=False, no_tags=False, baseline=False):
485
git_branch="master", checkpoint=10000, marks=None,
486
import_marks=None, export_marks=None, revision=None,
487
plain=True, rewrite_tag_names=False, no_tags=False, baseline=False):
484
488
load_fastimport()
485
489
from ...branch import Branch
486
490
from . import exporter
494
498
branch = Branch.open_containing(source)[0]
495
499
outf = exporter._get_output_stream(destination)
496
500
exporter = exporter.BzrFastExporter(branch,
497
outf=outf, ref=b"refs/heads/%s" % git_branch.encode('utf-8'), checkpoint=checkpoint,
498
import_marks_file=import_marks, export_marks_file=export_marks,
499
revision=revision, verbose=verbose, plain_format=plain,
500
rewrite_tags=rewrite_tag_names, no_tags=no_tags, baseline=baseline)
501
outf=outf, ref=b"refs/heads/%s" % git_branch.encode('utf-8'), checkpoint=checkpoint,
502
import_marks_file=import_marks, export_marks_file=export_marks,
503
revision=revision, verbose=verbose, plain_format=plain,
504
rewrite_tags=rewrite_tag_names, no_tags=no_tags, baseline=baseline)
501
505
return exporter.run()