~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: abentley
  • Date: 2005-09-09 05:54:43 UTC
  • mto: (1185.3.4)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: abentley@lappy-20050909055443-3fb77426cc101cdb
fixes for common ancestor picker

Show diffs side-by-side

added added

removed removed

Lines of Context:
264
264
    descendants = {}
265
265
    lines = [revision]
266
266
    root = None
 
267
    descendants[revision] = {}
267
268
    while len(lines) > 0:
268
269
        new_lines = set()
269
270
        for line in lines:
299
300
    for node, node_dec in descendants_b.iteritems():
300
301
        if node not in descendants:
301
302
            descendants[node] = set()
302
 
        ancestors[node].update(node_anc)
 
303
        descendants[node].update(descendants)
303
304
    return root, ancestors, descendants, common
304
305
 
305
306
def common_ancestor(revision_a, revision_b, revision_source):
306
307
    root, ancestors, descendants, common = \
307
308
        combined_graph(revision_a, revision_b, revision_source)
308
 
    nodes = farthest_node(ancestors, descendants, root)
 
309
    nodes = farthest_node(descendants, ancestors, root)
309
310
    for node in nodes:
310
311
        if node in common:
311
312
            return node