diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | cmds.py | 25 |
2 files changed, 27 insertions, 1 deletions
@@ -17,6 +17,9 @@ Features * New option --rewrite-tag-names for 'bzr fast-export'. (Alex Usov, #872601) +* New option --dont-squash-empty-commits for 'bzr fast-import-filter'. + (Alex Usov, #877303) + 0.11 2011-08-22 Bug fixes @@ -387,6 +387,15 @@ class cmd_fast_import_filter(Command): User mapping is supported by both the fast-import and fast-import-filter commands. + :History rewriting: + + By default fast-import-filter does quite aggressive history rewriting. + Empty commits (or commits which had all their content filtered out) will + be removed, and so are the references to commits not included in the stream. + + Flag --dont-squash-empty-commits reverses this behavior and makes it possible to + use fast-import-filter on incremental streams. + :Examples: Create a new project from a library (note the trailing / on the @@ -415,16 +424,30 @@ class cmd_fast_import_filter(Command): Option('user-map', type=str, help="Path to file containing a map of user-ids.", ), + Option('dont-squash-empty-commits', + help="Preserve all commits and links between them" + ), ] encoding_type = 'exact' def run(self, source=None, verbose=False, include_paths=None, - exclude_paths=None, user_map=None): + exclude_paths=None, user_map=None, dont_squash_empty_commits=False): + from bzrlib.errors import BzrCommandError load_fastimport() from fastimport.processors import filter_processor params = { 'include_paths': include_paths, 'exclude_paths': exclude_paths, } + if ('squash_empty_commits' in + filter_processor.FilterProcessor.known_params): + params['squash_empty_commits'] = (not dont_squash_empty_commits) + else: + if dont_squash_empty_commits: + raise BzrCommandError("installed python-fastimport does not " + "support not squashing empty commits. Please install " + " a newer python-fastimport to use " + "--dont-squash-empty-commits") + from fastimport import parser stream = _get_source_stream(source) user_mapper = _get_user_mapper(user_map) |