/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

identify unmarked blobs and commits by line numbers

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
        self.named_branches = []
68
68
        # Blob usage tracking
69
69
        self.blobs = {}
70
 
        for usage in ['new', 'used', 'multi', 'unknown']:
 
70
        for usage in ['new', 'used', 'multi', 'unknown', 'unmarked']:
71
71
            self.blobs[usage] = set()
72
72
        # Head tracking: map of commit mark to ref
73
73
        self.heads = {}
 
74
        self.last_ids = {}
74
75
 
75
76
    def post_process(self):
76
77
        # Dump statistics
153
154
    def blob_handler(self, cmd):
154
155
        """Process a BlobCommand."""
155
156
        self.cmd_counts[cmd.name] += 1
156
 
        self.blobs['new'].add(":" + cmd.mark)
 
157
        if cmd.mark is None:
 
158
            self.blobs['unmarked'].add(cmd.id)
 
159
        else:
 
160
            self.blobs['new'].add(cmd.id)
157
161
 
158
162
    def checkpoint_handler(self, cmd):
159
163
        """Process a CheckpointCommand."""
179
183
                    else:
180
184
                        self.sha_blob_references = True
181
185
        # Track the heads
182
 
        for parent in cmd.parents:
 
186
        if cmd.mark is None:
 
187
            last_id = self.last_ids.get(cmd.ref)
 
188
            if last_id is not None:
 
189
                parents = [last_id]
 
190
            else:
 
191
                parents = []
 
192
        else:
 
193
            parents = cmd.parents
 
194
        for parent in parents:
183
195
            try:
184
196
                del self.heads[parent]
185
197
            except KeyError:
186
 
                print "hmm - didn't find parent %s" % parent
187
 
                pass
188
 
        self.heads[":" + cmd.mark] = cmd.ref
189
 
            
 
198
                note("hmm - didn't find parent %s" % parent)
 
199
        self.heads[cmd.id] = cmd.ref
 
200
        self.last_ids[cmd.ref] = cmd.id
190
201
 
191
202
    def reset_handler(self, cmd):
192
203
        """Process a ResetCommand."""