18
18
# Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
23
from breezy import osutils, urlutils
25
24
from paste.httpexceptions import HTTPServerError
27
from loggerhead import util
28
from loggerhead.controllers import TemplatedBranchView
27
from ..controllers import TemplatedBranchView
31
30
class ChangeLogUI(TemplatedBranchView):
33
template_path = 'loggerhead.templates.changelog'
32
template_name = 'changelog'
35
34
def get_values(self, path, kwargs, headers):
36
35
history = self._history
37
36
revid = self.get_revid()
38
filter_file_id = kwargs.get('filter_file_id', None)
37
filter_path = kwargs.get('filter_path', path)
39
38
query = kwargs.get('q', None)
40
39
start_revid = history.fix_revid(kwargs.get('start_revid', None))
41
40
orig_start_revid = start_revid
42
pagesize = 20#int(config.get('pagesize', '20'))
41
pagesize = 20 #int(config.get('pagesize', '20'))
43
42
search_failed = False
45
if filter_file_id is None and path is not None:
46
filter_file_id = history.get_file_id(revid, path)
49
45
revid, start_revid, revid_list = history.get_view(
50
revid, start_revid, filter_file_id, query,
46
revid, start_revid, filter_path, query,
51
47
extra_rev_count=pagesize+1)
52
48
util.set_context(kwargs)
68
64
for i, c in enumerate(changes):
70
data[str(i)] = urllib.quote(urllib.quote(c.revid, safe=''))
66
data[str(i)] = urlutils.quote(urlutils.quote_from_bytes(c.revid, safe=''))
72
68
self.log.exception('Exception fetching changes')
73
69
raise HTTPServerError('Could not fetch changes')
75
71
navigation = util.Container(
76
72
pagesize=pagesize, revid=revid, start_revid=start_revid,
77
revid_list=revid_list, filter_file_id=filter_file_id,
73
revid_list=revid_list, filter_path=filter_path,
78
74
scan_url='/changes', branch=self._branch, feed=True, history=history)
79
75
if query is not None:
80
76
navigation.query = query
97
93
'branch': self._branch,
98
94
'changes': changes,
99
95
'show_tag_col': show_tag_col,
100
'data': simplejson.dumps(data),
96
'data': json.dumps(data),
102
98
'history': history,
104
100
'navigation': navigation,
105
'filter_file_id': filter_file_id,
101
'filter_path': filter_path,
106
102
'start_revid': start_revid,
107
103
'viewing_from': (orig_start_revid is not None) and
108
104
(orig_start_revid != history.last_revid),