~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

  • Committer: Robert Collins
  • Date: 2005-11-22 21:28:30 UTC
  • mfrom: (1185.33.32 bzr.dev)
  • Revision ID: robertc@robertcollins.net-20051122212830-885c284847f0b17b
Merge from mpool.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
import bzrlib.weave
35
35
from bzrlib.config import extract_email_address
 
36
from bzrlib.errors import BzrError
36
37
 
37
38
 
38
39
def annotate_file(branch, rev_id, file_id, verbose=False, full=False,
84
85
            except BzrError:
85
86
                pass        # use the whole name
86
87
        yield (revno_str, author, date_str, line_rev_id, text)
87
 
 
88
 
 
89
 
if __name__ == '__main__':
90
 
    from bzrlib.branch import Branch
91
 
    from bzrlib.trace import enable_default_logging
92
 
    from bzrlib.workingtree import WorkingTree
93
 
 
94
 
    enable_default_logging()
95
 
    b = Branch.open_containing(sys.argv[1])[0]
96
 
    tree = WorkingTree(b.base, b)
97
 
    rp = tree.relpath(sys.argv[1])
98
 
    tree = b.revision_tree(b.last_revision())
99
 
    file_id = tree.inventory.path2id(rp)
100
 
    file_version = tree.inventory[file_id].revision
101
 
    annotate_file(b, file_version, file_id, to_file = sys.stdout)