summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-10-22 15:05:34 -0700
committerJelmer Vernooij <jelmer@samba.org>2011-10-22 15:05:34 -0700
commite39c9988cfa62242be63b003c4b4cbcf3dce5e79 (patch)
tree8ecfa5c2defb0007f329f1cc4322203d390e7d54
parent312db166607189c3375a0eac42cf5d721804cdbc (diff)
parent310366242244327fbe930f7ae5e86671c735b310 (diff)
downloadbzr-fastimport-e39c9988cfa62242be63b003c4b4cbcf3dce5e79.tar.gz
Merge in support for --dont-squash-empty-commits.
-rw-r--r--NEWS3
-rw-r--r--cmds.py25
2 files changed, 27 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 3926888..32c469a 100644
--- a/NEWS
+++ b/NEWS
@@ -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
diff --git a/cmds.py b/cmds.py
index d5aedd6..06dc1f7 100644
--- a/cmds.py
+++ b/cmds.py
@@ -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)