summaryrefslogtreecommitdiff
path: root/processors/info_processor.py
diff options
context:
space:
mode:
authorIan Clatworthy <ian.clatworthy@canonical.com>2009-02-20 20:26:38 +1000
committerIan Clatworthy <ian.clatworthy@canonical.com>2009-02-20 20:26:38 +1000
commitc9c607b3ea54fa970d00cba98bc05c460fff7c16 (patch)
tree62d6d62d1ccea6ad7cf7d66425701a5dc40bf594 /processors/info_processor.py
parentc95ed35583f4f7100744de56eaf44546e4264c7d (diff)
downloadbzr-fastimport-c9c607b3ea54fa970d00cba98bc05c460fff7c16.tar.gz
extend fast-import-info with merges, rename old paths & copy source paths
Diffstat (limited to 'processors/info_processor.py')
-rw-r--r--processors/info_processor.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/processors/info_processor.py b/processors/info_processor.py
index 69a36cd..d3d3160 100644
--- a/processors/info_processor.py
+++ b/processors/info_processor.py
@@ -67,6 +67,11 @@ class InfoProcessor(processor.ImportProcessor):
# Head tracking: map of commit mark to ref
self.heads = {}
self.last_ids = {}
+ # Stuff to cache: a map from mark to count
+ self.merges = {}
+ # Stuff to cache: these are maps from ref name to sets
+ self.rename_old_paths = {}
+ self.copy_source_paths = {}
def post_process(self):
# Dump statistics
@@ -99,6 +104,12 @@ class InfoProcessor(processor.ImportProcessor):
self._dump_stats_group("Head analysis", heads.keys(),
heads.values(), None, _iterable_as_config_list)
# note("\t%d\t%s" % (len(self.committers), 'unique committers'))
+ self._dump_stats_group("Merges", self.merges.keys(),
+ self.merges.values(), None)
+ self._dump_stats_group("Rename old paths", self.rename_old_paths.keys(),
+ self.rename_old_paths.values(), len, _iterable_as_config_list)
+ self._dump_stats_group("Copy source paths", self.copy_source_paths.keys(),
+ self.copy_source_paths.values(), len, _iterable_as_config_list)
# Blob stats
if self.cmd_counts['blob']:
@@ -183,6 +194,11 @@ class InfoProcessor(processor.ImportProcessor):
self._track_blob(fc.dataref)
else:
self.sha_blob_references = True
+ elif isinstance(fc, commands.FileRenameCommand):
+ self.rename_old_paths.setdefault(cmd.ref, set()).add(fc.old_path)
+ elif isinstance(fc, commands.FileCopyCommand):
+ self.copy_source_paths.setdefault(cmd.ref, set()).add(fc.src_path)
+
# Track the heads
if cmd.from_ is not None:
parents = [cmd.from_]
@@ -210,6 +226,15 @@ class InfoProcessor(processor.ImportProcessor):
if parent_count > self.max_parent_count:
self.max_parent_count = parent_count
+ # Remember the merges
+ if cmd.merges:
+ #self.merges.setdefault(cmd.ref, set()).update(cmd.merges)
+ for merge in cmd.merges:
+ if merge in self.merges:
+ self.merges[merge] += 1
+ else:
+ self.merges[merge] = 1
+
def reset_handler(self, cmd):
"""Process a ResetCommand."""
self.cmd_counts[cmd.name] += 1