~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/deprecated_graph.py

  • Committer: Robert Collins
  • Date: 2007-07-04 08:08:13 UTC
  • mfrom: (2572 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2587.
  • Revision ID: robertc@robertcollins.net-20070704080813-wzebx0r88fvwj5rq
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005 Canonical
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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):