~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_known_graph_pyx.pyx

  • Committer: John Arbash Meinel
  • Date: 2009-08-13 21:54:04 UTC
  • mto: This revision was merged to the branch mainline in revision 4629.
  • Revision ID: john@arbash-meinel.com-20090813215404-f1e6vemv7vxyivoe
Create the crude merge_sort implementation that just thunks over to the old implementation.
The main win here is that we get to copy across all the tests so far, and they all pass. :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
454
454
                    child.seen = 0
455
455
        # We started from the parents, so we don't need to do anymore work
456
456
        return topo_order
 
457
 
 
458
 
 
459
    def merge_sort(self, tip_key):
 
460
        """Compute the merge sorted graph output."""
 
461
        cdef _KnownGraphNode node, parent_node
 
462
        from bzrlib import tsort
 
463
        # TODO: merge_sort doesn't handle ghosts (yet), figure out what to do
 
464
        #       when we want it to.
 
465
        as_parent_map = {}
 
466
        for node in self._nodes.itervalues():
 
467
            parent_keys = []
 
468
            for parent_node in node.parents:
 
469
                parent_keys.append(parent_node.key)
 
470
            as_parent_map[node.key] = parent_keys
 
471
        # We intentionally always generate revnos and never force the
 
472
        # mainline_revisions
 
473
        return tsort.merge_sort(as_parent_map, tip_key,
 
474
                                mainline_revisions=None,
 
475
                                generate_revno=True)