diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-10-25 16:21:02 -0700 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-10-25 16:21:02 -0700 |
commit | e4e439b7bba4b6e26bfd2cc4904242ea120aace5 (patch) | |
tree | 33eda181643612733005dab9ffd735b554e724b4 | |
parent | e39c9988cfa62242be63b003c4b4cbcf3dce5e79 (diff) | |
download | bzr-fastimport-e4e439b7bba4b6e26bfd2cc4904242ea120aace5.tar.gz |
Some refactoring of exporter.
-rw-r--r-- | cmds.py | 10 | ||||
-rw-r--r-- | exporter.py | 10 |
2 files changed, 11 insertions, 9 deletions
@@ -663,13 +663,17 @@ class cmd_fast_export(Command): import_marks=None, export_marks=None, revision=None, plain=True, rewrite_tag_names=False): load_fastimport() + from bzrlib.branch import Branch from bzrlib.plugins.fastimport import exporter if marks: import_marks = export_marks = marks - exporter = exporter.BzrFastExporter(source, - destination=destination, - git_branch=git_branch, checkpoint=checkpoint, + + # Open the source + branch = Branch.open_containing(source)[0] + outf = exporter._get_output_stream(destination) + exporter = exporter.BzrFastExporter(branch, + outf=outf, git_branch=git_branch, checkpoint=checkpoint, import_marks_file=import_marks, export_marks_file=export_marks, revision=revision, verbose=verbose, plain_format=plain, rewrite_tags=rewrite_tag_names) diff --git a/exporter.py b/exporter.py index 7848c52..e4b5132 100644 --- a/exporter.py +++ b/exporter.py @@ -143,9 +143,10 @@ def sanitize_ref_name_for_git(refname): "_", refname) return new_refname + class BzrFastExporter(object): - def __init__(self, source, destination, git_branch=None, checkpoint=-1, + def __init__(self, source, outf, git_branch=None, checkpoint=-1, import_marks_file=None, export_marks_file=None, revision=None, verbose=False, plain_format=False, rewrite_tags=False): """Export branch data in fast import format. @@ -159,8 +160,8 @@ class BzrFastExporter(object): Otherwise tags which aren't valid for git will be skipped if plain_format is set. """ - self.source = source - self.outf = _get_output_stream(destination) + self.branch = source + self.outf = outf self.git_branch = git_branch self.checkpoint = checkpoint self.import_marks_file = import_marks_file @@ -215,9 +216,6 @@ class BzrFastExporter(object): return list(view_revisions) def run(self): - # Open the source - self.branch = bzrlib.branch.Branch.open_containing(self.source)[0] - # Export the data self.branch.repository.lock_read() try: |