~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: v.ladeuil+lp at free
  • Date: 2007-05-18 18:20:31 UTC
  • mto: (2485.8.44 bzr.connection.sharing)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070518182031-gbg2cgidv5l20x9p
Takes Robert comments into account.

* bzrlib/transport/ftp.py:
(FtpTransport.__init__): Write a better explanation.

* bzrlib/tests/test_init.py:
(InstrumentedTransport): Just make hooks a class attribute.
(InstrumentedTransport._get_FTP): Run hook directly in the for
loop.
(TransportHooks.run_hook, TransportHooks.uninstall_hook): Not
needed. The hooks should be cleaned up by the test itself.
(TestInit.setUp.cleanup): Resset to default hooks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# perhaps show them in log -v and allow them as options to the commit command.
19
19
 
20
20
 
21
 
from bzrlib import (
22
 
    errors,
23
 
    symbol_versioning
24
 
    )
25
 
from bzrlib.deprecated_graph import (
26
 
    all_descendants,
27
 
    Graph,
28
 
    node_distances,
29
 
    select_farthest,
30
 
    )
 
21
import bzrlib.errors as errors
 
22
from bzrlib.graph import node_distances, select_farthest, all_descendants, Graph
31
23
from bzrlib.osutils import contains_whitespace
32
24
from bzrlib.progress import DummyProgress
33
25
from bzrlib.symbol_versioning import (deprecated_function,
127
119
    revisions_source is an object supporting a get_revision operation that
128
120
    behaves like Branch's.
129
121
    """
130
 
    if is_null(candidate_id):
131
 
        return True
132
 
    return (candidate_id in branch.repository.get_ancestry(revision_id,
133
 
            topo_sorted=False))
 
122
    return (candidate_id in branch.repository.get_ancestry(revision_id))
134
123
 
135
124
 
136
125
def iter_ancestors(revision_id, revision_source, only_present=False):
264
253
                [revision_a, revision_b])
265
254
            # Shortcut the case where one of the tips is already included in
266
255
            # the other graphs ancestry.
267
 
            ancestry_a = graph.get_ancestry(revision_a, topo_sorted=False)
 
256
            ancestry_a = graph.get_ancestry(revision_a)
268
257
            if revision_b in ancestry_a:
269
258
                return revision_b
270
 
            ancestry_b = graph.get_ancestry(revision_b, topo_sorted=False)
 
259
            ancestry_b = graph.get_ancestry(revision_b)
271
260
            if revision_a in ancestry_b:
272
261
                return revision_a
273
262
            # convert to a NULL_REVISION based graph.
487
476
    """Raise ReservedId if the supplied revision_id is reserved"""
488
477
    if is_reserved_id(revision_id):
489
478
        raise errors.ReservedId(revision_id)
490
 
 
491
 
 
492
 
def ensure_null(revision_id):
493
 
    """Ensure only NULL_REVISION is used to represent the null revisionn"""
494
 
    if revision_id is None:
495
 
        return NULL_REVISION
496
 
    else:
497
 
        return revision_id
498
 
 
499
 
 
500
 
def is_null(revision_id):
501
 
    if revision_id is None:
502
 
        symbol_versioning.warn('NULL_REVISION should be used for the null'
503
 
            ' revision instead of None, as of bzr 0.19.',
504
 
            DeprecationWarning, stacklevel=2)
505
 
    return revision_id in (None, NULL_REVISION)