diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2011-10-22 14:39:03 -0700 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2011-10-22 14:39:03 -0700 |
commit | e92e99dcdad632d0676b1e6146cc557a13054aa9 (patch) | |
tree | 6033d3848bba43fd684c93f065b5682eb3feaee6 | |
parent | 5f76c2ac819b967baf1a40867acf239e425d8ebe (diff) | |
download | python-fastimport-e92e99dcdad632d0676b1e6146cc557a13054aa9.tar.gz |
Only fix references to commits that have been squashed rather than removing everything that we haven't touched yet
-rw-r--r-- | fastimport/processors/filter_processor.py | 9 | ||||
-rw-r--r-- | fastimport/tests/test_filter_processor.py | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/fastimport/processors/filter_processor.py b/fastimport/processors/filter_processor.py index 954c2e8..f26e273 100644 --- a/fastimport/processors/filter_processor.py +++ b/fastimport/processors/filter_processor.py @@ -50,8 +50,8 @@ class FilterProcessor(processor.ImportProcessor): self.new_root = helpers.common_directory(self.includes) # Buffer of blobs until we know we need them: mark -> cmd self.blobs = {} - # These are the commits we've output so far - self.interesting_commits = set() + # These are the commits we've squashed so far + self.squashed_commits = set() # Map of commit-id to list of parents self.parents = {} @@ -111,7 +111,8 @@ class FilterProcessor(processor.ImportProcessor): # Update from and merges to refer to commits in the output cmd.from_ = self._find_interesting_from(cmd.from_) cmd.merges = self._find_interesting_merges(cmd.merges) - self.interesting_commits.add(cmd.id) + else: + self.squashed_commits.add(cmd.id) # Keep track of the parents if cmd.from_ and cmd.merges: @@ -208,7 +209,7 @@ class FilterProcessor(processor.ImportProcessor): def _find_interesting_parent(self, commit_ref): while True: - if commit_ref in self.interesting_commits: + if commit_ref not in self.squashed_commits: return commit_ref parents = self.parents.get(commit_ref) if not parents: diff --git a/fastimport/tests/test_filter_processor.py b/fastimport/tests/test_filter_processor.py index ad040d7..c3ae21e 100644 --- a/fastimport/tests/test_filter_processor.py +++ b/fastimport/tests/test_filter_processor.py @@ -798,6 +798,7 @@ committer d <b@c> 1234798653 +0000 data 8 test ing +from :100 deleteall M 644 :4 index.txt """) |