/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: David Allouche
  • Date: 2006-03-26 20:30:07 UTC
  • Revision ID: david.allouche@canonical.com-20060326203007-2ad964c45a24a622
early exit accurate sorting when maxnum is set

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
                if pending_count == 0:
151
151
                    ancestor_ids_of[parent_id] = None
152
152
 
153
 
    def sort_revisions(self, sorted_revids):
 
153
    def sort_revisions(self, sorted_revids, maxnum):
154
154
        revisions = self.revisions
155
155
        parent_ids_of = self.parent_ids_of
156
156
        children_of_id = self.children_of_id
178
178
            else:
179
179
                # all children are here, push!
180
180
                distances[revid] = len(distances)
 
181
                if maxnum is not None and len(distances) > maxnum:
 
182
                    # bail out early if a limit was specified
 
183
                    sorted_revids[:0] = skipped_revids
 
184
                    for revid in sorted_revids:
 
185
                        distances[revid] = len(distances)
 
186
                    break
181
187
                # all parents will need to be pushed as soon as possible
182
188
                for parent in parent_ids_of[revision]:
183
189
                    if parent not in pending_ids:
281
287
    children = distance.make_children_map()
282
288
    if accurate:
283
289
        print 'accurate sorting'
284
 
        sorted_revids = distance.sort_revisions(sorted_revids)
 
290
        sorted_revids = distance.sort_revisions(sorted_revids, maxnum)
285
291
    for revid in sorted_revids:
286
292
        distance.choose_colour(revid)
287
293