~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Aaron Bentley
  • Date: 2007-06-21 02:33:43 UTC
  • mfrom: (2530.1.1 get_ancestry_no_topo)
  • mto: This revision was merged to the branch mainline in revision 2542.
  • Revision ID: aaron.bentley@utoronto.ca-20070621023343-3f3oy8iszatpjcui
Merge of not-sorting-ancestry branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
939
939
        except KeyError:
940
940
            raise RevisionNotPresent(version_id, self.filename)
941
941
 
942
 
    def get_ancestry(self, versions):
 
942
    def get_ancestry(self, versions, topo_sorted=True):
943
943
        """See VersionedFile.get_ancestry."""
944
944
        if isinstance(versions, basestring):
945
945
            versions = [versions]
946
946
        if not versions:
947
947
            return []
948
948
        versions = [osutils.safe_revision_id(v) for v in versions]
949
 
        return self._index.get_ancestry(versions)
 
949
        return self._index.get_ancestry(versions, topo_sorted)
950
950
 
951
951
    def get_ancestry_with_ghosts(self, versions):
952
952
        """See VersionedFile.get_ancestry_with_ghosts."""
1217
1217
    def get_graph(self):
1218
1218
        return [(vid, idx[4]) for vid, idx in self._cache.iteritems()]
1219
1219
 
1220
 
    def get_ancestry(self, versions):
 
1220
    def get_ancestry(self, versions, topo_sorted=True):
1221
1221
        """See VersionedFile.get_ancestry."""
1222
1222
        # get a graph of all the mentioned versions:
1223
1223
        graph = {}
1233
1233
            # if not completed and not a ghost
1234
1234
            pending.update([p for p in parents if p not in graph])
1235
1235
            graph[version] = parents
 
1236
        if not topo_sorted:
 
1237
            return graph.keys()
1236
1238
        return topo_sort(graph.items())
1237
1239
 
1238
1240
    def get_ancestry_with_ghosts(self, versions):