~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_known_graph_py.py

  • 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:
19
19
 
20
20
from bzrlib import (
21
21
    revision,
 
22
    tsort,
22
23
    )
23
24
 
24
25
 
172
173
        return heads
173
174
 
174
175
    def topo_sort(self):
175
 
        from bzrlib import tsort
176
176
        as_parent_map = dict((node.key, node.parent_keys)
177
177
                             for node in self._nodes.itervalues()
178
178
                              if node.parent_keys is not None)
179
179
        return tsort.topo_sort(as_parent_map)
 
180
 
 
181
    def merge_sort(self, tip_key):
 
182
        """Compute the merge sorted graph output."""
 
183
        # TODO: merge_sort doesn't handle ghosts (yet), figure out what to do
 
184
        #       when we want it to.
 
185
        as_parent_map = dict((node.key, node.parent_keys)
 
186
                             for node in self._nodes.itervalues())
 
187
        # We intentionally always generate revnos and never force the
 
188
        # mainline_revisions
 
189
        return tsort.merge_sort(as_parent_map, tip_key,
 
190
                                mainline_revisions=None,
 
191
                                generate_revno=True)