From 82a5bc916aaba4d98a70d1cdab47dc3838447cf5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 10 Mar 2011 02:02:39 +0100 Subject: Fix fast-import-info. --- NEWS | 5 +++++ cmds.py | 17 +++++++---------- tests/test_commands.py | 41 +++++++++++++++++++++++++++++++++++++++++ 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 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: +""") -- cgit v1.2.1