~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__known_graph.py

  • Committer: John Arbash Meinel
  • Date: 2009-08-17 20:41:26 UTC
  • mto: This revision was merged to the branch mainline in revision 4629.
  • Revision ID: john@arbash-meinel.com-20090817204126-fokcicx22mwsgud0
Change the KnownGraph.merge_sort api.

Instead of being a tuple api, it is now an Object api. TIMEIT testing at least
seems to say that _MergeSortNode.key is no slower than using a tuple.
Allocating the nodes is also not much slower (especially since we already needed
them.)

In the end it makes for an api which, IMO, is much easier to use, so
since performance isn't impacted, it is worth switching.


Also, determined that we needed to implement the new get_known_graph... on
the weave code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
336
336
        """Check that merge based sorting and iter_topo_order on graph works."""
337
337
        graph = self.make_known_graph(ancestry)
338
338
        value = graph.merge_sort(branch_tip)
 
339
        value = [(n.key, n.merge_depth, n.revno, n.end_of_merge)
 
340
                 for n in value]
339
341
        if result_list != value:
340
342
            self.assertEqualDiff(pprint.pformat(result_list),
341
343
                                 pprint.pformat(value))