~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Robert Collins
  • Date: 2007-06-26 08:52:20 UTC
  • mto: This revision was merged to the branch mainline in revision 2554.
  • Revision ID: robertc@robertcollins.net-20070626085220-iovhwfjflk8vffbh
Add require_api API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
 
21
21
import bzrlib.errors as errors
22
 
from bzrlib.graph import node_distances, select_farthest, all_descendants, Graph
 
22
from bzrlib.deprecated_graph import (
 
23
    all_descendants,
 
24
    Graph,
 
25
    node_distances,
 
26
    select_farthest,
 
27
    )
23
28
from bzrlib.osutils import contains_whitespace
24
29
from bzrlib.progress import DummyProgress
25
30
from bzrlib.symbol_versioning import (deprecated_function,
119
124
    revisions_source is an object supporting a get_revision operation that
120
125
    behaves like Branch's.
121
126
    """
122
 
    return (candidate_id in branch.repository.get_ancestry(revision_id))
 
127
    return (candidate_id in branch.repository.get_ancestry(revision_id,
 
128
            topo_sorted=False))
123
129
 
124
130
 
125
131
def iter_ancestors(revision_id, revision_source, only_present=False):
253
259
                [revision_a, revision_b])
254
260
            # Shortcut the case where one of the tips is already included in
255
261
            # the other graphs ancestry.
256
 
            ancestry_a = graph.get_ancestry(revision_a)
 
262
            ancestry_a = graph.get_ancestry(revision_a, topo_sorted=False)
257
263
            if revision_b in ancestry_a:
258
264
                return revision_b
259
 
            ancestry_b = graph.get_ancestry(revision_b)
 
265
            ancestry_b = graph.get_ancestry(revision_b, topo_sorted=False)
260
266
            if revision_a in ancestry_b:
261
267
                return revision_a
262
268
            # convert to a NULL_REVISION based graph.
476
482
    """Raise ReservedId if the supplied revision_id is reserved"""
477
483
    if is_reserved_id(revision_id):
478
484
        raise errors.ReservedId(revision_id)
 
485
 
 
486
def ensure_null(revision_id):
 
487
    """Ensure only NULL_REVISION is used to represent the null revisionn"""
 
488
    if revision_id is None:
 
489
        return NULL_REVISION
 
490
    else:
 
491
        return revision_id