~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/deprecated_graph.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-06-21 05:22:37 UTC
  • mfrom: (2490.2.33 graphwalker)
  • Revision ID: pqm@pqm.ubuntu.com-20070621052237-2phm1z5dg4arrwnk
Avoid topological sorting in Repository.get_ancestry where possible

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
        """Return a dictionary of graph node:ancestor_list entries."""
143
143
        return dict(self._graph_ancestors.items())
144
144
 
145
 
    def get_ancestry(self, node_id):
 
145
    def get_ancestry(self, node_id, topo_sorted=True):
146
146
        """Return the inclusive ancestors of node_id in topological order."""
147
147
        # maybe optimise this ?
148
148
        result = {}
155
155
            for parent in parents:
156
156
                if parent not in result and parent not in pending:
157
157
                    pending.add(parent)
 
158
        if not topo_sorted:
 
159
            return result.keys()
158
160
        return topo_sort(result.items())
159
161
 
160
162
    def get_descendants(self):