~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-22 18:24:25 UTC
  • mfrom: (1803 +trunk)
  • mto: (1793.3.6 bundle-fixes)
  • mto: This revision was merged to the branch mainline in revision 1806.
  • Revision ID: john@arbash-meinel.com-20060622182425-6f45cb7acd587216
[merge] bzr.dev 1804 and fix conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005 Canonical
 
1
# Copyright (C) 2005, 2006 Canonical
2
2
 
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
# perhaps show them in log -v and allow them as options to the commit command.
19
19
 
20
20
 
21
 
import bzrlib.errors
22
21
import bzrlib.errors as errors
23
22
from bzrlib.graph import node_distances, select_farthest, all_descendants, Graph
24
23
from bzrlib.osutils import contains_whitespace
25
24
from bzrlib.progress import DummyProgress
26
 
from bzrlib.symbol_versioning import *
 
25
from bzrlib.symbol_versioning import (deprecated_function,
 
26
        zero_eight,
 
27
        )
27
28
 
28
29
NULL_REVISION="null:"
29
30
 
130
131
                yield ancestor, distance
131
132
            try:
132
133
                revision = revision_source.get_revision(ancestor)
133
 
            except bzrlib.errors.NoSuchRevision, e:
 
134
            except errors.NoSuchRevision, e:
134
135
                if e.revision == revision_id:
135
136
                    raise 
136
137
                else:
220
221
    root_b, ancestors_b, descendants_b = revision_graph(
221
222
        revision_b, revision_source)
222
223
    if root != root_b:
223
 
        raise bzrlib.errors.NoCommonRoot(revision_a, revision_b)
 
224
        raise errors.NoCommonRoot(revision_a, revision_b)
224
225
    common = set()
225
226
    for node, node_anc in ancestors_b.iteritems():
226
227
        if node in ancestors:
273
274
                
274
275
            root = NULL_REVISION
275
276
            common.add(NULL_REVISION)
276
 
        except bzrlib.errors.NoCommonRoot:
277
 
            raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
 
277
        except errors.NoCommonRoot:
 
278
            raise errors.NoCommonAncestor(revision_a, revision_b)
278
279
            
279
280
        pb.update('Picking ancestor', 2, 3)
280
281
        distances = node_distances (descendants, ancestors, root)
281
282
        pb.update('Picking ancestor', 3, 2)
282
283
        farthest = select_farthest(distances, common)
283
284
        if farthest is None or farthest == NULL_REVISION:
284
 
            raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
 
285
            raise errors.NoCommonAncestor(revision_a, revision_b)
285
286
    finally:
286
287
        pb.clear()
287
288
    return farthest
306
307
        for source in self._revision_sources:
307
308
            try:
308
309
                return source.get_revision(revision_id)
309
 
            except bzrlib.errors.NoSuchRevision, e:
 
310
            except errors.NoSuchRevision, e:
310
311
                pass
311
312
        raise e
312
313
 
419
420
    """
420
421
    root, ancestors, descendants = revision_graph(rev_id, rev_source)
421
422
    if len(descendants) == 0:
422
 
        raise NoSuchRevision(rev_source, rev_id)
 
423
        raise errors.NoSuchRevision(rev_source, rev_id)
423
424
    if ancestor_id not in descendants:
424
425
        rev_source.get_revision(ancestor_id)
425
 
        raise bzrlib.errors.NotAncestor(rev_id, ancestor_id)
 
426
        raise errors.NotAncestor(rev_id, ancestor_id)
426
427
    root_descendants = all_descendants(descendants, ancestor_id)
427
428
    root_descendants.add(ancestor_id)
428
429
    if rev_id not in root_descendants:
429
 
        raise bzrlib.errors.NotAncestor(rev_id, ancestor_id)
 
430
        raise errors.NotAncestor(rev_id, ancestor_id)
430
431
    distances = node_distances(descendants, ancestors, ancestor_id,
431
432
                               root_descendants=root_descendants)
432
433