/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

  • Committer: Martin Pool
  • Date: 2009-03-13 07:54:48 UTC
  • mfrom: (4144 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4189.
  • Revision ID: mbp@sourcefrog.net-20090313075448-jlz1t7baz7gzipqn
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""File annotate based on weave storage"""
18
18
 
19
19
# TODO: Choice of more or less verbose formats:
20
 
 
20
#
21
21
# interposed: show more details between blocks of modified lines
22
22
 
23
23
# TODO: Show which revision caused a line to merge into the parent
24
24
 
25
25
# TODO: perhaps abbreviate timescales depending on how recent they are
26
 
# e.g. "3:12 Tue", "13 Oct", "Oct 2005", etc.  
 
26
# e.g. "3:12 Tue", "13 Oct", "Oct 2005", etc.
27
27
 
28
28
import sys
29
29
import time
151
151
 
152
152
 
153
153
def _show_id_annotations(annotations, to_file, full):
 
154
    if not annotations:
 
155
        return
154
156
    last_rev_id = None
155
157
    max_origin_len = max(len(origin) for origin, text in annotations)
156
158
    for origin, text in annotations:
166
168
def _annotations(repo, file_id, rev_id):
167
169
    """Return the list of (origin_revision_id, line_text) for a revision of a file in a repository."""
168
170
    annotations = repo.texts.annotate((file_id, rev_id))
169
 
    # 
 
171
    #
170
172
    return [(key[-1], line) for (key, line) in annotations]
171
173
 
172
174
 
208
210
        revision_id_to_revno[CURRENT_REVISION] = (
209
211
            "%d?" % (branch.revno() + 1),)
210
212
        revisions[CURRENT_REVISION] = current_rev
211
 
    revision_ids = [o for o in revision_ids if 
 
213
    revision_ids = [o for o in revision_ids if
212
214
                    repository.has_revision(o)]
213
 
    revisions.update((r.revision_id, r) for r in 
 
215
    revisions.update((r.revision_id, r) for r in
214
216
                     repository.get_revisions(revision_ids))
215
217
    for origin, text in annotations:
216
218
        text = text.rstrip('\r\n')
229
231
                                     time.gmtime(rev.timestamp + tz))
230
232
            # a lazy way to get something like the email address
231
233
            # TODO: Get real email address
232
 
            author = rev.get_apparent_author()
 
234
            author = rev.get_apparent_authors()[0]
233
235
            try:
234
236
                author = extract_email_address(author)
235
237
            except errors.NoEmailInUsername:
241
243
               _left_matching_blocks=None,
242
244
               heads_provider=None):
243
245
    """Create a new annotated version from new lines and parent annotations.
244
 
    
 
246
 
245
247
    :param parents_lines: List of annotated lines for all parents
246
248
    :param new_lines: The un-annotated new lines
247
249
    :param new_revision_id: The revision-id to associate with new lines