~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Aaron Bentley
  • Date: 2005-09-18 19:21:48 UTC
  • mto: (1185.1.29)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: aaron.bentley@utoronto.ca-20050918192148-3f9373ac85a83b02
Refactored and documented graph stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
 
18
18
import bzrlib.errors
19
 
from bzrlib.graph import farthest_nodes, node_distances, all_descendants
 
19
from bzrlib.graph import node_distances, select_farthest, all_descendants
20
20
 
21
21
class RevisionReference(object):
22
22
    """
257
257
    except bzrlib.errors.NoCommonRoot:
258
258
        raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
259
259
        
260
 
    nodes = farthest_nodes(descendants, ancestors, root)
261
 
    for node in nodes:
262
 
        if node in common:
263
 
            return node
264
 
    raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
 
260
    distances = node_distances (descendants, ancestors, root)
 
261
    farthest = select_farthest(distances, common)
 
262
    if farthest is None:
 
263
        raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
 
264
    return farthest
265
265
 
266
266
class MultipleRevisionSources(object):
267
267
    """Proxy that looks in multiple branches for revisions."""