~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: John Arbash Meinel
  • Date: 2006-10-24 14:12:53 UTC
  • mto: This revision was merged to the branch mainline in revision 2095.
  • Revision ID: john@arbash-meinel.com-20061024141253-783fba812b197b70
(John Arbash Meinel) Update version information for 0.13 development

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
 
126
126
    def add_node(self, node_id, parent_ids):
127
127
        """Add node_id to the graph with parent_ids as its parents."""
128
 
        if len(parent_ids) == 0:
 
128
        if parent_ids == []:
129
129
            self.roots.add(node_id)
130
130
        self._graph_ancestors[node_id] = list(parent_ids)
131
131
        self._ensure_descendant(node_id)
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, topo_sorted=True):
 
145
    def get_ancestry(self, node_id):
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()
160
158
        return topo_sort(result.items())
161
159
 
162
160
    def get_descendants(self):