2
# Copyright (C) 2006 Robey Pointer <robey@lag.net>
3
# Copyright (C) 2006 Goffredo Baroncelli <kreijack@inwind.it>
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
from paste.httpexceptions import HTTPBadRequest
25
from loggerhead.controllers import TemplatedBranchView
26
from loggerhead import util
30
while path.endswith('/'):
32
path = posixpath.dirname(path)
35
class AnnotateUI (TemplatedBranchView):
37
template_path = 'loggerhead.templates.annotate'
39
def get_values(self, h, args, kw, headers):
41
revid = h.fix_revid(args[0])
47
path = '/'.join(args[1:])
48
if not path.startswith('/'):
51
file_id = kw.get('file_id', None)
52
if (file_id is None) and (path is None):
53
raise HTTPBadRequest('No file_id or filename provided to annotate')
56
file_id = h.get_file_id(revid, path)
58
# no navbar for revisions
59
navigation = util.Container()
62
path = h.get_path(revid, file_id)
63
filename = os.path.basename(path)
70
'navigation': navigation,
71
'change': h.get_changes([ revid ])[0],
72
'contents': list(h.annotate_file(file_id, revid)),
73
'fileview_active': True,