41
42
class AnnotateUI (object):
44
def __init__(self, branch):
49
@util.strip_whitespace
43
50
@turbogears.expose(html='loggerhead.templates.annotate')
44
51
def default(self, *args, **kw):
46
h = util.get_history()
53
h = self._branch.get_history()
57
revid = h.fix_revid(args[0])
53
path = kw.get('path', None)
54
if (path == '/') or (path == '') or (path is None):
55
raise HTTPRedirect(turbogears.url('/changes'))
61
file_id = kw.get('file_id', None)
63
raise HTTPRedirect(self._branch.url('/changes'))
58
revlist, revid = h.get_navigation(revid, path)
59
file_id = h.get_inventory(revid).path2id(path)
66
revid_list, revid = h.get_file_view(revid, file_id)
60
67
except Exception, x:
61
log.error('Exception fetching changes: %r, %s' % (x, x))
62
raise HTTPRedirect(turbogears.url('/changes'))
68
self.log.error('Exception fetching changes: %s' % (x,))
69
util.log_exception(self.log)
70
raise HTTPRedirect(self._branch.url('/changes'))
65
('top', turbogears.url('/changes')),
66
('revision', turbogears.url([ '/revision', revid ], path=path)),
67
('history', turbogears.url([ '/changes', revid ], path=path)),
70
72
# no navbar for revisions
71
navigation = util.Container(buttons=buttons)
73
navigation = util.Container()
75
path = h.get_path(revid, file_id)
76
filename = os.path.basename(path)
74
'branch_name': turbogears.config.get('loggerhead.branch_name'),
79
'branch': self._branch,
79
86
'navigation': navigation,
80
'change': h.get_change(revid),
87
'change': h.get_changes([ revid ])[0],
81
88
'contents': list(h.annotate_file(file_id, revid)),
84
log.info('/annotate: %r secs' % (time.time() - z,))
91
self.log.info('/annotate: %r secs' % (time.time() - z,))