~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

Fix BzrDir.create_workingtree for NULL_REVISION

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