42
42
class AnnotateUI (object):
44
def __init__(self, branch):
49
@util.strip_whitespace
50
44
@turbogears.expose(html='loggerhead.templates.annotate')
51
45
def default(self, *args, **kw):
53
h = self._branch.get_history()
47
h = util.get_history()
50
revid = h.fix_revid(args[0])
54
path = kw.get('path', None)
55
if (path == '/') or (path == '') or (path is None):
56
raise HTTPRedirect(turbogears.url('/changes'))
59
revid = h.fix_revid(args[0])
65
path = '/'.join(args[1:])
66
if not path.startswith('/'):
69
file_id = kw.get('file_id', None)
70
if (file_id is None) and (path is None):
71
raise HTTPError(400, 'No file_id or filename provided to annotate')
74
file_id = h.get_file_id(revid, path)
76
# no navbar for revisions
77
navigation = util.Container()
80
path = h.get_path(revid, file_id)
81
filename = os.path.basename(path)
84
'branch': self._branch,
91
'navigation': navigation,
92
'change': h.get_changes([ revid ])[0],
93
'contents': list(h.annotate_file(file_id, revid)),
96
self.log.info('/annotate: %r secs' % (time.time() - z,))
59
revlist, revid = h.get_navigation(revid, path)
60
file_id = h.get_inventory(revid).path2id(path)
62
log.error('Exception fetching changes: %r, %s' % (x, x))
63
raise HTTPRedirect(turbogears.url('/changes'))
65
# no navbar for revisions
66
navigation = util.Container()
69
'branch_name': util.get_config().get('branch_name'),
74
'navigation': navigation,
75
'change': h.get_change(revid),
76
'contents': list(h.annotate_file(file_id, revid)),
79
log.info('/annotate: %r secs' % (time.time() - z,))