~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

  • Committer: Robert Collins
  • Date: 2008-09-02 01:26:52 UTC
  • mto: This revision was merged to the branch mainline in revision 3724.
  • Revision ID: robertc@robertcollins.net-20080902012652-4ha6zs6m1r21onx7
Review feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    tsort,
36
36
    )
37
37
from bzrlib.config import extract_email_address
 
38
from bzrlib.repository import _strip_NULL_ghosts
38
39
from bzrlib.revision import CURRENT_REVISION, Revision
39
40
 
40
41
 
89
90
    if show_ids:
90
91
        return _show_id_annotations(annotations, to_file, full)
91
92
 
92
 
    # Calculate the lengths of the various columns
 
93
    # Create a virtual revision to represent the current tree state.
 
94
    # Should get some more pending commit attributes, like pending tags,
 
95
    # bugfixes etc.
93
96
    current_rev = Revision(CURRENT_REVISION)
94
97
    current_rev.parent_ids = tree.get_parent_ids()
95
98
    current_rev.committer = tree.branch.get_config().username()
96
99
    current_rev.message = "?"
97
100
    current_rev.timestamp = round(time.time(), 3)
98
101
    current_rev.timezone = osutils.local_time_offset()
99
 
    # Should get pending tags/fixes etc - pending commit attributes.
100
102
    annotation = list(_expand_annotations(annotations, tree.branch,
101
103
        current_rev))
102
104
    _print_annotations(annotation, verbose, to_file, full)
179
181
    :param branch: A locked branch to query for revision details.
180
182
    """
181
183
    repository = branch.repository
182
 
    revision_id_to_revno = branch.get_revision_id_to_revno_map()
 
184
    if current_rev is not None:
 
185
        # This can probably become a function on MutableTree, get_revno_map there,
 
186
        # or something.
 
187
        last_revision = current_rev.revision_id
 
188
        # XXX: Partially Cloned from branch, uses the old_get_graph, eep.
 
189
        graph = repository.get_graph()
 
190
        revision_graph = dict(((key, value) for key, value in
 
191
            graph.iter_ancestry(current_rev.parent_ids) if value is not None))
 
192
        revision_graph = _strip_NULL_ghosts(revision_graph)
 
193
        revision_graph[last_revision] = current_rev.parent_ids
 
194
        merge_sorted_revisions = tsort.merge_sort(
 
195
            revision_graph,
 
196
            last_revision,
 
197
            None,
 
198
            generate_revno=True)
 
199
        revision_id_to_revno = dict((rev_id, revno)
 
200
            for seq_num, rev_id, depth, revno, end_of_merge in
 
201
                merge_sorted_revisions)
 
202
    else:
 
203
        revision_id_to_revno = branch.get_revision_id_to_revno_map()
183
204
    last_origin = None
184
205
    revision_ids = set(o for o, t in annotations)
185
206
    revisions = {}