/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: John Arbash Meinel
  • Date: 2008-04-24 16:58:13 UTC
  • mto: This revision was merged to the branch mainline in revision 3407.
  • Revision ID: john@arbash-meinel.com-20080424165813-nzlmhwbj05c8ao1c
Simple brute-force implementation of find_unique_ancestors

Show diffs side-by-side

added added

removed removed

Lines of Context:
207
207
        right = searchers[1].seen
208
208
        return (left.difference(right), right.difference(left))
209
209
 
 
210
    def find_unique_ancestors(self, unique_revision, common_revisions):
 
211
        """Find the unique ancestors for a revision versus others.
 
212
 
 
213
        This returns the ancestry of unique_revision, excluding all revisions
 
214
        in the ancestry of common_revisions. If unique_revision is in the
 
215
        ancestry, then the empty set will be returned.
 
216
 
 
217
        :param unique_revision: The revision_id whose ancestry we are
 
218
            interested in.
 
219
        :param common_revisions: Revision_ids of ancestries to exclude.
 
220
        :return: A set of revisions in the ancestry of unique_revision
 
221
        """
 
222
        common_revisions = set(common_revisions)
 
223
        # Simple brute force implementation. Ugly, but gets the tests working
 
224
        # first.
 
225
        if unique_revision in common_revisions:
 
226
            return set()
 
227
        unique_ancestors = set(x[0] for x in self.iter_ancestry([unique_revision]))
 
228
        common_ancestors = set(x[0] for x in self.iter_ancestry(common_revisions))
 
229
        return unique_ancestors - common_ancestors
 
230
 
210
231
    @symbol_versioning.deprecated_method(symbol_versioning.one_one)
211
232
    def get_parents(self, revisions):
212
233
        """Find revision ids of the parents of a list of revisions