~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

[patch] Aaron Bentley: make revert work in a subdirectory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
# e.g. "3:12 Tue", "13 Oct", "Oct 2005", etc.  
27
27
 
28
28
import sys
 
29
import os
29
30
import time
30
31
 
 
32
import bzrlib.weave
31
33
from bzrlib.config import extract_email_address
32
34
from bzrlib.errors import BzrError
33
35
 
53
55
def _annotate_file(branch, rev_id, file_id ):
54
56
 
55
57
    rh = branch.revision_history()
56
 
    w = branch.repository.weave_store.get_weave(file_id, 
57
 
        branch.repository.get_transaction())
 
58
    w = branch.weave_store.get_weave(file_id, branch.get_transaction())
58
59
    last_origin = None
59
60
    for origin, text in w.annotate_iter(rev_id):
60
61
        text = text.rstrip('\r\n')
62
63
            (revno_str, author, date_str) = ('','','')
63
64
        else:
64
65
            last_origin = origin
65
 
            if not branch.repository.has_revision(origin):
 
66
            line_rev_id = w.idx_to_name(origin)
 
67
            if not branch.has_revision(line_rev_id):
66
68
                (revno_str, author, date_str) = ('?','?','?')
67
69
            else:
68
 
                if origin in rh:
69
 
                    revno_str = str(rh.index(origin) + 1)
 
70
                if line_rev_id in rh:
 
71
                    revno_str = str(rh.index(line_rev_id) + 1)
70
72
                else:
71
73
                    revno_str = 'merge'
72
 
            rev = branch.repository.get_revision(origin)
 
74
            rev = branch.get_revision(line_rev_id)
73
75
            tz = rev.timezone or 0
74
76
            date_str = time.strftime('%Y%m%d', 
75
77
                                     time.gmtime(rev.timestamp + tz))
80
82
                author = extract_email_address(author)
81
83
            except BzrError:
82
84
                pass        # use the whole name
83
 
        yield (revno_str, author, date_str, origin, text)
 
85
        yield (revno_str, author, date_str, line_rev_id, text)