Help needed with implementing annotate
Jeremy Wilkins
jeb at jdwilkins.co.uk
Thu Nov 29 20:10:21 GMT 2007
Hi All,
I've been doing some work on the TextMate integration with Bazaar.
I've been trying to implement annotate support, the approach is to
iterate over each line in the file and spit out a HTML table, which
TextMate can render with an embedded webkit window.
The code I've got at the minute, only works if the file your trying to
annotate had changes in the most recent commit, this is using
annotate._annotate_file, eg
annotate_file =
os.environ['TM_FILEPATH'].lstrip(os.environ['TM_PROJECT_DIRECTORY'])
tree, relpath = workingtree.WorkingTree.open_containing(annotate_file)
b = tree.branch
revid = b.last_revision()
fileid = tree.path2id(annotate_file)
annotation = annotate._annotate_file(b, revid, fileid)
for (revno_str, author, date_str, line_rev_id, text) in annotation :
print "%s: %s<br />" % ( revno_str, text )
the other approach I've been playing with is below, using
workingtree.annotate_iter
tree, relpath = workingtree.WorkingTree.open_containing('filea.txt')
fileid = tree.path2id('filea.txt')
annotation = tree.annotate_iter(fileid)
for (revno_str, text) in annotation :
print "%s: %s<br />" % ( revno_str, text )
This seems more reliable but only gives a long string containing what
I presume is a unique identified for the file. Is there anyway to get
author and rev no information from this identifier? Or is there an
alternative approach I should be using.
Thanks
jebw
More information about the bazaar
mailing list