/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to processors/info_processor.py

  • Committer: Ian Clatworthy
  • Date: 2009-02-25 12:06:28 UTC
  • mto: (0.64.130 trunk)
  • mto: This revision was merged to the branch mainline in revision 6631.
  • Revision ID: ian.clatworthy@canonical.com-20090225120628-i5ajdqy8j7krmt32
update fast-import-info to use same head-tracking code as fast-import

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    warning,
23
23
    )
24
24
from bzrlib.plugins.fastimport import (
 
25
    cache_manager,
25
26
    commands,
26
27
    helpers,
27
28
    processor,
64
65
        self.blobs = {}
65
66
        for usage in ['new', 'used', 'multi', 'unknown', 'unmarked']:
66
67
            self.blobs[usage] = set()
67
 
        # Head tracking: map of commit mark to ref
68
 
        # (Head tracking future - delegate to the cache manager)
69
 
        self.heads = {}
70
 
        self.last_ids = {}
71
 
        #self.cache_mgr = cache_manager.CacheManager(inventory_cache_size=0)
 
68
        # Head tracking - delegate to the cache manager
 
69
        self.cache_mgr = cache_manager.CacheManager(inventory_cache_size=0)
72
70
        # Stuff to cache: a map from mark to # of times that mark is merged
73
71
        self.merges = {}
74
72
        # Stuff to cache: these are maps from mark to sets
105
103
            self._dump_stats_group("Parent counts", p_names, p_values, str)
106
104
            self._dump_stats_group("Commit analysis", flags.keys(),
107
105
                flags.values(), _found)
108
 
            heads = helpers.invert_dict(self.heads)
 
106
            heads = helpers.invert_dictset(self.cache_mgr.heads)
109
107
            self._dump_stats_group("Head analysis", heads.keys(),
110
108
                heads.values(), None, _iterable_as_config_list)
111
109
            # note("\t%d\t%s" % (len(self.committers), 'unique committers'))
205
203
                self.copy_source_paths.setdefault(cmd.id, set()).add(fc.src_path)
206
204
 
207
205
        # Track the heads
208
 
        # (future: parents = self.cache_mgr.track_heads(cmd))
209
 
        if cmd.from_ is not None:
210
 
            parents = [cmd.from_]
211
 
        else:
212
 
            last_id = self.last_ids.get(cmd.ref)
213
 
            if last_id is not None:
214
 
                parents = [last_id]
215
 
            else:
216
 
                parents = []
217
 
        parents.extend(cmd.merges)
218
 
        for parent in parents:
219
 
            try:
220
 
                del self.heads[parent]
221
 
            except KeyError:
222
 
                # it's ok if the parent isn't there - another
223
 
                # commit may have already removed it
224
 
                pass
225
 
        self.heads[cmd.id] = cmd.ref
226
 
        self.last_ids[cmd.ref] = cmd.id
 
206
        parents = self.cache_mgr.track_heads(cmd)
227
207
 
228
208
        # Track the parent counts
229
209
        parent_count = len(parents)
250
230
            self.lightweight_tags += 1
251
231
        else:
252
232
            self.named_branches.append(cmd.ref)
253
 
            # future ...
254
 
            #if cmd.from_ is not None:
255
 
            #    self.cache_mgr.track_heads_for_ref(cmd.ref, cmd.from_)
 
233
            if cmd.from_ is not None:
 
234
                self.cache_mgr.track_heads_for_ref(cmd.ref, cmd.from_)
256
235
 
257
236
    def tag_handler(self, cmd):
258
237
        """Process a TagCommand."""