~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

(John Arbash Meinel) Change Branch.pull() so it doesn't have to
        search all history all the time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
242
242
            order if they need it.
243
243
        """
244
244
        candidate_heads = set(keys)
 
245
        if revision.NULL_REVISION in candidate_heads:
 
246
            # NULL_REVISION is only a head if it is the only entry
 
247
            candidate_heads.remove(revision.NULL_REVISION)
 
248
            if not candidate_heads:
 
249
                return set([revision.NULL_REVISION])
245
250
        if len(candidate_heads) < 2:
246
251
            return candidate_heads
247
252
        searchers = dict((c, self._make_breadth_first_searcher([c]))
348
353
        smallest number of parent looksup to determine the ancestral
349
354
        relationship between N revisions.
350
355
        """
351
 
        if revision.is_null(candidate_ancestor):
352
 
            return True
353
 
        if revision.is_null(candidate_descendant):
354
 
            # if candidate_descendant is NULL_REVISION, then only
355
 
            # candidate_ancestor == NULL_REVISION is an ancestor, but we've
356
 
            # already handled that case.
357
 
            return False
358
356
        return set([candidate_descendant]) == self.heads(
359
357
            [candidate_ancestor, candidate_descendant])
360
358