40
46
template_path = 'loggerhead.templates.inventory'
42
def get_values(self, h, args, kw, headers):
44
revid = h.fix_revid(args[0])
48
def get_values(self, path, kwargs, headers):
49
history = self._history
50
revid = self.get_revid()
49
inv = h.get_inventory(revid)
53
inv = history.get_inventory(revid)
51
55
self.log.exception('Exception fetching changes')
52
56
raise HTTPServerError('Could not fetch changes')
54
file_id = kw.get('file_id', inv.root.file_id)
55
start_revid = kw.get('start_revid', None)
56
sort_type = kw.get('sort', None)
58
file_id = kwargs.get('file_id', None)
59
start_revid = kwargs.get('start_revid', None)
60
sort_type = kwargs.get('sort', None)
58
62
# no navbar for revisions
59
63
navigation = util.Container()
61
change = h.get_changes([ revid ])[0]
65
change = history.get_changes([ revid ])[0]
62
66
# add parent & merge-point branch-nick info, in case it's useful
63
h.get_branch_nicks([ change ])
65
path = inv.id2path(file_id)
66
if not path.startswith('/'):
68
idpath = inv.get_idpath(file_id)
71
updir_file_id = idpath[-2]
67
history.get_branch_nicks([ change ])
70
if not path.startswith('/'):
72
file_id = history.get_file_id(revid, path)
74
path = inv.id2path(file_id)
77
file_id = inv.root.file_id
79
# Are we at the top of the tree
80
if inv.is_root(file_id):
83
updir = dirname(path)[1:]
85
# Directory Breadcrumbs
86
directory_breadcrumbs = util.directory_breadcrumbs(
87
self._branch.friendly_name,
91
if not is_null_rev(revid):
93
inv = history.get_inventory(revid)
95
self.log.exception('Exception fetching changes')
96
raise HTTPServerError('Could not fetch changes')
98
change = history.get_changes([ revid ])[0]
99
# If we're looking at the tip, use head: in the URL instead
100
if revid == history.last_revid:
103
revno_url = history.get_revno(revid)
104
# add parent & merge-point branch-nick info, in case it's useful
105
history.get_branch_nicks([ change ])
107
# Create breadcrumb trail for the path within the branch
108
branch_breadcrumbs = util.branch_breadcrumbs(path, inv, 'files')
109
filelist = history.get_filelist(inv, file_id, sort_type)
118
branch_breadcrumbs = []
79
122
'branch': self._branch,
125
'revno_url': revno_url,
83
127
'file_id': file_id,
86
'updir_file_id': updir_file_id,
87
'filelist': h.get_filelist(inv, file_id, sort_type),
130
'filelist': filelist,
89
132
'posixpath': posixpath,
90
133
'navigation': navigation,
91
134
'url': self._branch.context_url,
92
135
'start_revid': start_revid,
93
136
'fileview_active': True,
137
'directory_breadcrumbs': directory_breadcrumbs,
138
'branch_breadcrumbs': branch_breadcrumbs,