~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

Upgraded to the latest bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
251
251
            pb.update('Picking ancestor', 1, 3)
252
252
            graph = revision_source.get_revision_graph_with_ghosts(
253
253
                [revision_a, revision_b])
 
254
            # Shortcut the case where one of the tips is already included in
 
255
            # the other graphs ancestry.
 
256
            ancestry_a = graph.get_ancestry(revision_a)
 
257
            if revision_b in ancestry_a:
 
258
                return revision_b
 
259
            ancestry_b = graph.get_ancestry(revision_b)
 
260
            if revision_a in ancestry_b:
 
261
                return revision_a
254
262
            # convert to a NULL_REVISION based graph.
255
263
            ancestors = graph.get_ancestors()
256
264
            descendants = graph.get_descendants()
257
 
            common = set(graph.get_ancestry(revision_a)).intersection(
258
 
                     set(graph.get_ancestry(revision_b)))
 
265
            common = set(ancestry_a)
 
266
            common.intersection_update(ancestry_b)
259
267
            descendants[NULL_REVISION] = {}
260
268
            ancestors[NULL_REVISION] = []
261
269
            for root in graph.roots: