~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Robert Collins
  • Date: 2008-03-28 03:54:40 UTC
  • mto: This revision was merged to the branch mainline in revision 3313.
  • Revision ID: robertc@robertcollins.net-20080328035440-4cflvryqujresn2g
Reduce code duplication as per review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
    get_terminal_encoding,
73
73
    terminal_width,
74
74
    )
 
75
from bzrlib.repository import _strip_NULL_ghosts
75
76
from bzrlib.revision import (
76
77
    NULL_REVISION,
77
78
    )
463
464
    # This asks for all mainline revisions, which means we only have to spider
464
465
    # sideways, rather than depth history. That said, its still size-of-history
465
466
    # and should be addressed.
466
 
    search = graph._make_breadth_first_searcher(mainline_revisions)
467
 
    transitive_ids = set()
468
 
    map(transitive_ids.update, list(search))
469
 
    parent_map = graph.get_parent_map(transitive_ids)
 
467
    parent_map = dict(((key, value) for key, value in
 
468
        graph.iter_ancestry(mainline_revisions) if value is not None))
470
469
    sorted_rev_list = topo_sort(parent_map.items())
471
470
    ancestry = {}
472
471
    for rev in sorted_rev_list:
516
515
    # This asks for all mainline revisions, which means we only have to spider
517
516
    # sideways, rather than depth history. That said, its still size-of-history
518
517
    # and should be addressed.
519
 
    search = graph._make_breadth_first_searcher(mainline_revs)
520
 
    transitive_ids = set()
521
 
    map(transitive_ids.update, list(search))
522
 
    parent_map = graph.get_parent_map(transitive_ids)
 
518
    parent_map = dict(((key, value) for key, value in
 
519
        graph.iter_ancestry(mainline_revs) if value is not None))
523
520
    # filter out ghosts; merge_sort errors on ghosts.
524
 
    rev_graph = {}
525
 
    # Filter ghosts, and null:
526
 
    if NULL_REVISION in parent_map:
527
 
        del parent_map[NULL_REVISION]
528
 
    for key, parents in parent_map.iteritems():
529
 
        rev_graph[key] = tuple(parent for parent in parents if parent in
530
 
            parent_map)
 
521
    rev_graph = _strip_NULL_ghosts(parent_map)
531
522
    merge_sorted_revisions = merge_sort(
532
523
        rev_graph,
533
524
        mainline_revs[-1],