summaryrefslogtreecommitdiff
path: root/processors
diff options
context:
space:
mode:
authorIan Clatworthy <ian.clatworthy@canonical.com>2009-02-17 22:10:58 +1000
committerIan Clatworthy <ian.clatworthy@canonical.com>2009-02-17 22:10:58 +1000
commitdd8a3df741ad08fbda807ed3730f0ada5dbe71e6 (patch)
tree9a130bb1b43e58ba3c8a52a6c588796c33b1e6ac /processors
parentd4c7335714ad80b21c3854780fac27c2b348be2a (diff)
downloadbzr-fastimport-dd8a3df741ad08fbda807ed3730f0ada5dbe71e6.tar.gz
deleteall tests & tweaks
Diffstat (limited to 'processors')
-rw-r--r--processors/filter_processor.py42
1 files changed, 17 insertions, 25 deletions
diff --git a/processors/filter_processor.py b/processors/filter_processor.py
index 58c8953..3435743 100644
--- a/processors/filter_processor.py
+++ b/processors/filter_processor.py
@@ -96,19 +96,25 @@ class FilterProcessor(processor.ImportProcessor):
# These pass through if they meet the filtering conditions
interesting_filecmds = self._filter_filecommands(cmd.file_iter)
if interesting_filecmds:
- cmd.file_iter = iter(interesting_filecmds)
- self.keep = True
+ # If all we have is a single deleteall, skip this commit
+ if len(interesting_filecmds) == 1 and isinstance(
+ interesting_filecmds[0], commands.FileDeleteAllCommand):
+ pass
+ else:
+ # Remember just the interesting file commands
+ self.keep = True
+ cmd.file_iter = iter(interesting_filecmds)
- # Record the referenced blobs
- for fc in interesting_filecmds:
- if isinstance(fc, commands.FileModifyCommand):
- if fc.dataref is not None:
- self.referenced_blobs.append(fc.dataref)
+ # Record the referenced blobs
+ for fc in interesting_filecmds:
+ if isinstance(fc, commands.FileModifyCommand):
+ if fc.dataref is not None:
+ self.referenced_blobs.append(fc.dataref)
- # 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.mark)
+ # 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)
# Keep track of the parents
if cmd.from_ and cmd.merges:
@@ -142,20 +148,6 @@ class FilterProcessor(processor.ImportProcessor):
if not text.endswith("\n"):
self.outf.write("\n")
- def _find_new_root(self, paths):
- """Find the deepest common directory for a list of paths."""
- if not paths:
- return None
- elif len(paths) == 1:
- if paths[0].endswith('/'):
- return paths[0]
- else:
- dirname,basename = osutils.split(paths[0])
- return dirname + '/'
- else:
- # TODO: handle multiple paths
- return None
-
def _filter_filecommands(self, filecmd_iter):
"""Return the filecommands filtered by includes & excludes.