Show More
@@ -130,7 +130,7 b' def make_map(config):' | |||||
130 | controller='changeset', revision='tip', |
|
130 | controller='changeset', revision='tip', | |
131 | conditions=dict(function=check_repo)) |
|
131 | conditions=dict(function=check_repo)) | |
132 | map.connect('raw_changeset_home', '/{repo_name:.*}/raw-changeset/{revision}', |
|
132 | map.connect('raw_changeset_home', '/{repo_name:.*}/raw-changeset/{revision}', | |
133 | controller='changeset',action='raw_changeset', revision='tip', |
|
133 | controller='changeset', action='raw_changeset', revision='tip', | |
134 | conditions=dict(function=check_repo)) |
|
134 | conditions=dict(function=check_repo)) | |
135 | map.connect('summary_home', '/{repo_name:.*}/summary', |
|
135 | map.connect('summary_home', '/{repo_name:.*}/summary', | |
136 | controller='summary', conditions=dict(function=check_repo)) |
|
136 | controller='summary', conditions=dict(function=check_repo)) | |
@@ -148,9 +148,12 b' def make_map(config):' | |||||
148 | map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}', |
|
148 | map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}', | |
149 | controller='files', action='diff', revision='tip', f_path='', |
|
149 | controller='files', action='diff', revision='tip', f_path='', | |
150 | conditions=dict(function=check_repo)) |
|
150 | conditions=dict(function=check_repo)) | |
151 | map.connect('files_raw_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}', |
|
151 | map.connect('files_rawfile_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}', | |
152 | controller='files', action='rawfile', revision='tip', f_path='', |
|
152 | controller='files', action='rawfile', revision='tip', f_path='', | |
153 | conditions=dict(function=check_repo)) |
|
153 | conditions=dict(function=check_repo)) | |
|
154 | map.connect('files_raw_home', '/{repo_name:.*}/raw/{revision}/{f_path:.*}', | |||
|
155 | controller='files', action='raw', revision='tip', f_path='', | |||
|
156 | conditions=dict(function=check_repo)) | |||
154 | map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', |
|
157 | map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', | |
155 | controller='files', action='annotate', revision='tip', f_path='', |
|
158 | controller='files', action='annotate', revision='tip', f_path='', | |
156 | conditions=dict(function=check_repo)) |
|
159 | conditions=dict(function=check_repo)) |
@@ -45,6 +45,7 b' class FilesController(BaseController):' | |||||
45 | 'repository.admin') |
|
45 | 'repository.admin') | |
46 | def __before__(self): |
|
46 | def __before__(self): | |
47 | super(FilesController, self).__before__() |
|
47 | super(FilesController, self).__before__() | |
|
48 | c.file_size_limit = 250 * 1024 #limit of file size to display | |||
48 |
|
49 | |||
49 | def index(self, repo_name, revision, f_path): |
|
50 | def index(self, repo_name, revision, f_path): | |
50 | hg_model = HgModel() |
|
51 | hg_model = HgModel() | |
@@ -76,7 +77,6 b' class FilesController(BaseController):' | |||||
76 | revision=next_rev, f_path=f_path) |
|
77 | revision=next_rev, f_path=f_path) | |
77 |
|
78 | |||
78 | c.changeset = repo.get_changeset(revision) |
|
79 | c.changeset = repo.get_changeset(revision) | |
79 |
|
||||
80 |
|
80 | |||
81 | c.cur_rev = c.changeset.raw_id |
|
81 | c.cur_rev = c.changeset.raw_id | |
82 | c.rev_nr = c.changeset.revision |
|
82 | c.rev_nr = c.changeset.revision | |
@@ -96,6 +96,14 b' class FilesController(BaseController):' | |||||
96 | response.content_disposition = 'attachment; filename=%s' \ |
|
96 | response.content_disposition = 'attachment; filename=%s' \ | |
97 | % f_path.split('/')[-1] |
|
97 | % f_path.split('/')[-1] | |
98 | return file_node.content |
|
98 | return file_node.content | |
|
99 | ||||
|
100 | def raw(self, repo_name, revision, f_path): | |||
|
101 | hg_model = HgModel() | |||
|
102 | c.repo = hg_model.get_repo(c.repo_name) | |||
|
103 | file_node = c.repo.get_changeset(revision).get_node(f_path) | |||
|
104 | response.content_type = 'text/plain' | |||
|
105 | ||||
|
106 | return file_node.content | |||
99 |
|
107 | |||
100 | def annotate(self, repo_name, revision, f_path): |
|
108 | def annotate(self, repo_name, revision, f_path): | |
101 | hg_model = HgModel() |
|
109 | hg_model = HgModel() |
@@ -23,7 +23,7 b'' | |||||
23 | </div> |
|
23 | </div> | |
24 | <div class="table"> |
|
24 | <div class="table"> | |
25 | <div id="files_data"> |
|
25 | <div id="files_data"> | |
26 |
<h |
|
26 | <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.file.path)}</h3> | |
27 | <dl class="overview"> |
|
27 | <dl class="overview"> | |
28 | <dt>${_('Last revision')}</dt> |
|
28 | <dt>${_('Last revision')}</dt> | |
29 | <dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset._short), |
|
29 | <dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset._short), | |
@@ -33,8 +33,10 b'' | |||||
33 | <dt>${_('Options')}</dt> |
|
33 | <dt>${_('Options')}</dt> | |
34 | <dd>${h.link_to(_('show source'), |
|
34 | <dd>${h.link_to(_('show source'), | |
35 | h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} |
|
35 | h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} | |
|
36 | / ${h.link_to(_('show as raw'), | |||
|
37 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} | |||
36 | / ${h.link_to(_('download as raw'), |
|
38 | / ${h.link_to(_('download as raw'), | |
37 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} |
|
39 | h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} | |
38 | </dd> |
|
40 | </dd> | |
39 | </dl> |
|
41 | </dl> | |
40 | <div id="body" class="codeblock"> |
|
42 | <div id="body" class="codeblock"> | |
@@ -43,7 +45,12 b'' | |||||
43 | <div class="commit">"${c.file_msg}"</div> |
|
45 | <div class="commit">"${c.file_msg}"</div> | |
44 | </div> |
|
46 | </div> | |
45 | <div class="code-body"> |
|
47 | <div class="code-body"> | |
46 | ${h.pygmentize_annotation(c.file,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")} |
|
48 | % if c.file.size < c.file_size_limit: | |
|
49 | ${h.pygmentize_annotation(c.file,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")} | |||
|
50 | %else: | |||
|
51 | ${_('File is to big to display')} ${h.link_to(_('show as raw'), | |||
|
52 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} | |||
|
53 | %endif | |||
47 | </div> |
|
54 | </div> | |
48 | </div> |
|
55 | </div> | |
49 | </div> |
|
56 | </div> |
@@ -8,9 +8,11 b'' | |||||
8 | <dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd> |
|
8 | <dd>${h.format_byte_size(c.files_list.size,binary=True)}</dd> | |
9 | <dt>${_('Options')}</dt> |
|
9 | <dt>${_('Options')}</dt> | |
10 | <dd>${h.link_to(_('show annotation'), |
|
10 | <dd>${h.link_to(_('show annotation'), | |
11 |
h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} |
|
11 | h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} | |
|
12 | / ${h.link_to(_('show as raw'), | |||
|
13 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} | |||
12 | / ${h.link_to(_('download as raw'), |
|
14 | / ${h.link_to(_('download as raw'), | |
13 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} |
|
15 | h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} | |
14 | </dd> |
|
16 | </dd> | |
15 | <dt>${_('History')}</dt> |
|
17 | <dt>${_('History')}</dt> | |
16 | <dd> |
|
18 | <dd> | |
@@ -32,7 +34,12 b'' | |||||
32 | <div class="commit">"${c.files_list.last_changeset.message}"</div> |
|
34 | <div class="commit">"${c.files_list.last_changeset.message}"</div> | |
33 | </div> |
|
35 | </div> | |
34 | <div class="code-body"> |
|
36 | <div class="code-body"> | |
35 | ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")} |
|
37 | % if c.files_list.size < c.file_size_limit: | |
|
38 | ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")} | |||
|
39 | %else: | |||
|
40 | ${_('File is to big to display')} ${h.link_to(_('show as raw'), | |||
|
41 | h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} | |||
|
42 | %endif | |||
36 | </div> |
|
43 | </div> | |
37 | </div> |
|
44 | </div> | |
38 |
|
45 |
General Comments 0
You need to be logged in to leave comments.
Login now