summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-03-10 02:02:39 +0100
committerJelmer Vernooij <jelmer@samba.org>2011-03-10 02:02:39 +0100
commit82a5bc916aaba4d98a70d1cdab47dc3838447cf5 (patch)
treea56f9c0548294ab11fa62dc203fe7f4b3917e080
parente4937b0761c50f87214805767f1210c8569ad342 (diff)
downloadbzr-fastimport-82a5bc916aaba4d98a70d1cdab47dc3838447cf5.tar.gz
Fix fast-import-info.
-rw-r--r--NEWS5
-rw-r--r--cmds.py17
-rw-r--r--tests/test_commands.py41
3 files changed, 53 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index 8b8ec51..72c4038 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,11 @@ bzr-fastimport Release Notes
0.11 UNRELEASED
+Bug fixes
+---------
+
+* Fix internal error in 'bzr fast-import-info'. (Jelmer Vernooij, #730833)
+
0.10 08-Mar-2011
Changes
diff --git a/cmds.py b/cmds.py
index 52170f7..eeb4a7f 100644
--- a/cmds.py
+++ b/cmds.py
@@ -23,22 +23,19 @@ from bzrlib.option import Option, ListOption, RegistryOption
from bzrlib.plugins.fastimport import load_fastimport
-def _run(source, processor_factory, control, params, verbose,
- user_map=None):
+def _run(source, processor_factory, verbose=False, user_map=None, **kwargs):
"""Create and run a processor.
:param source: a filename or '-' for standard input. If the
filename ends in .gz, it will be opened as a gzip file and
the stream will be implicitly uncompressed
:param processor_factory: a callable for creating a processor
- :param control: the BzrDir of the destination or None if no
- destination is expected
:param user_map: if not None, the file containing the user map.
"""
from fastimport import parser
stream = _get_source_stream(source)
user_mapper = _get_user_mapper(user_map)
- proc = processor_factory(control, params=params, verbose=verbose)
+ proc = processor_factory(verbose=verbose, **kwargs)
p = parser.ImportParser(stream, verbose=verbose, user_mapper=user_mapper)
return proc.process(p.iter_commands)
@@ -312,8 +309,8 @@ class cmd_fast_import(Command):
'import-marks': import_marks,
'export-marks': export_marks,
}
- return _run(source, generic_processor.GenericProcessor, control,
- params, verbose, user_map=user_map)
+ return _run(source, generic_processor.GenericProcessor, control=control,
+ params=params, verbose=verbose, user_map=user_map)
def _generate_info(self, source):
from cStringIO import StringIO
@@ -466,7 +463,7 @@ class cmd_fast_import_info(Command):
def run(self, source, verbose=False):
load_fastimport()
from fastimport.processors import info_processor
- return _run(source, info_processor.InfoProcessor, {}, verbose)
+ return _run(source, info_processor.InfoProcessor, verbose=verbose)
class cmd_fast_import_query(Command):
@@ -525,8 +522,8 @@ class cmd_fast_import_query(Command):
params = helpers.defines_to_dict(commands) or {}
if commit_mark:
params['commit-mark'] = commit_mark
- return _run(source, query_processor.QueryProcessor, params,
- verbose)
+ return _run(source, query_processor.QueryProcessor, params=params,
+ verbose=verbose)
class cmd_fast_export(Command):
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 437fd7b..231b141 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -77,3 +77,44 @@ class TestFastExport(ExternalBase):
data = self.run_bzr("fast-export br br.fi")[0]
self.assertEquals("", data)
self.failUnlessExists("br.fi")
+
+
+simple_fast_import_stream = """commit refs/heads/master
+mark :1
+committer Jelmer Vernooij <jelmer@samba.org> 1299718135 +0100
+data 7
+initial
+
+"""
+
+class TestFastImportInfo(ExternalBase):
+
+ def test_simple(self):
+ self.build_tree_contents([('simple.fi', simple_fast_import_stream)])
+ output = self.run_bzr("fast-import-info simple.fi")[0]
+ self.assertEquals(output, """Command counts:
+\t0\tblob
+\t0\tcheckpoint
+\t1\tcommit
+\t0\tfeature
+\t0\tprogress
+\t0\treset
+\t0\ttag
+File command counts:
+\t0\tfilemodify
+\t0\tfiledelete
+\t0\tfilecopy
+\t0\tfilerename
+\t0\tfiledeleteall
+Parent counts:
+\t1\tparents-0
+\t0\ttotal revisions merged
+Commit analysis:
+\tno\texecutables
+\tno\tseparate authors found
+\tno\tsymlinks
+\tno\tblobs referenced by SHA
+Head analysis:
+\t[':1']\trefs/heads/master
+Merges:
+""")