diff options
-rw-r--r-- | bzr_commit_handler.py | 11 | ||||
-rw-r--r-- | cache_manager.py | 9 | ||||
-rw-r--r-- | processors/info_processor.py | 16 |
3 files changed, 22 insertions, 14 deletions
diff --git a/bzr_commit_handler.py b/bzr_commit_handler.py index 8be2a84..0d64616 100644 --- a/bzr_commit_handler.py +++ b/bzr_commit_handler.py @@ -26,7 +26,6 @@ from bzrlib import ( serializer, ) from fastimport import ( - commands, helpers, processor, ) @@ -35,6 +34,12 @@ from fastimport import ( _serializer_handles_escaping = hasattr(serializer.Serializer, 'squashes_xml_invalid_characters') +# Bazaar file kinds +FILE_KIND = 'file' +DIRECTORY_KIND = 'directory' +SYMLINK_KIND = 'symlink' +TREE_REFERENCE_KIND = 'tree-reference' + def copy_inventory(inv): # This currently breaks revision-id matching @@ -826,9 +831,9 @@ class InventoryDeltaCommitHandler(GenericCommitHandler): def modify_handler(self, filecmd): if filecmd.dataref is not None: - if filecmd.kind == commands.DIRECTORY_KIND: + if filecmd.kind == DIRECTORY_KIND: data = None - elif filecmd.kind == commands.TREE_REFERENCE_KIND: + elif filecmd.kind == TREE_REFERENCE_KIND: data = filecmd.dataref else: data = self.cache_mgr.fetch_blob(filecmd.dataref) diff --git a/cache_manager.py b/cache_manager.py index 5a31a00..59f8911 100644 --- a/cache_manager.py +++ b/cache_manager.py @@ -23,7 +23,9 @@ import tempfile import weakref from bzrlib import lru_cache, trace -from bzrlib.plugins.fastimport import branch_mapper, helpers +from fastimport.helpers import ( + single_plural, + ) class _Cleanup(object): @@ -174,7 +176,7 @@ class CacheManager(object): size = size / 1024 unit = 'G' note(" %-12s: %8.1f %s (%d %s)" % (label, size, unit, count, - helpers.single_plural(count, "item", "items"))) + single_plural(count, "item", "items"))) def clear_all(self): """Free up any memory used by the caches.""" @@ -191,7 +193,7 @@ class CacheManager(object): total_blobs = len(sticky_blobs) blobs.sort(key=lambda k:len(sticky_blobs[k])) if self._tempdir is None: - tempdir = tempfile.mkdtemp(prefix='bzr_fastimport_blobs-') + tempdir = tempfile.mkdtemp(prefix='fastimport_blobs-') self._tempdir = tempdir self._cleanup.tempdir = self._tempdir self._cleanup.small_blobs = tempfile.TemporaryFile( @@ -232,7 +234,6 @@ class CacheManager(object): trace.note('flushed %d/%d blobs w/ %.1fMB (%.1fMB small) to disk' % (count, total_blobs, bytes / 1024. / 1024, n_small_bytes / 1024. / 1024)) - def store_blob(self, id, data): """Store a blob of data.""" diff --git a/processors/info_processor.py b/processors/info_processor.py index eb22b00..0f55f1c 100644 --- a/processors/info_processor.py +++ b/processors/info_processor.py @@ -17,16 +17,18 @@ """Import processor that dump stats about the input (and doesn't import).""" -from bzrlib.trace import ( - note, - warning, - ) from bzrlib.plugins.fastimport import ( cache_manager, + ) + +from fastimport import ( commands, - helpers, processor, ) +from fastimport.helpers import ( + invert_dict, + invert_dictset, + ) class InfoProcessor(processor.ImportProcessor): @@ -101,7 +103,7 @@ class InfoProcessor(processor.ImportProcessor): } self._dump_stats_group("Parent counts", p_items, str) self._dump_stats_group("Commit analysis", flags.iteritems(), _found) - heads = helpers.invert_dictset(self.cache_mgr.heads) + heads = invert_dictset(self.cache_mgr.heads) self._dump_stats_group("Head analysis", heads.iteritems(), None, _iterable_as_config_list) # note("\t%d\t%s" % (len(self.committers), 'unique committers')) @@ -125,7 +127,7 @@ class InfoProcessor(processor.ImportProcessor): self._dump_stats_group("Blob usage tracking", self.blobs.iteritems(), len, _iterable_as_config_list) if self.blob_ref_counts: - blobs_by_count = helpers.invert_dict(self.blob_ref_counts) + blobs_by_count = invert_dict(self.blob_ref_counts) blob_items = blobs_by_count.items() blob_items.sort() self._dump_stats_group("Blob reference counts", |