Show More
@@ -148,9 +148,12 b' def make_map(config):' | |||
|
148 | 148 | map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}', |
|
149 | 149 | controller='files', action='diff', revision='tip', f_path='', |
|
150 | 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 | 152 | controller='files', action='rawfile', revision='tip', f_path='', |
|
153 | 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 | 157 | map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', |
|
155 | 158 | controller='files', action='annotate', revision='tip', f_path='', |
|
156 | 159 | conditions=dict(function=check_repo)) |
@@ -45,6 +45,7 b' class FilesController(BaseController):' | |||
|
45 | 45 | 'repository.admin') |
|
46 | 46 | def __before__(self): |
|
47 | 47 | super(FilesController, self).__before__() |
|
48 | c.file_size_limit = 250 * 1024 #limit of file size to display | |
|
48 | 49 | |
|
49 | 50 | def index(self, repo_name, revision, f_path): |
|
50 | 51 | hg_model = HgModel() |
@@ -77,7 +78,6 b' class FilesController(BaseController):' | |||
|
77 | 78 | |
|
78 | 79 | c.changeset = repo.get_changeset(revision) |
|
79 | 80 | |
|
80 | ||
|
81 | 81 | c.cur_rev = c.changeset.raw_id |
|
82 | 82 | c.rev_nr = c.changeset.revision |
|
83 | 83 | c.files_list = c.changeset.get_node(f_path) |
@@ -97,6 +97,14 b' class FilesController(BaseController):' | |||
|
97 | 97 | % f_path.split('/')[-1] |
|
98 | 98 | return file_node.content |
|
99 | 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 | |
|
107 | ||
|
100 | 108 | def annotate(self, repo_name, revision, f_path): |
|
101 | 109 | hg_model = HgModel() |
|
102 | 110 | c.repo = hg_model.get_repo(c.repo_name) |
@@ -23,7 +23,7 b'' | |||
|
23 | 23 | </div> |
|
24 | 24 | <div class="table"> |
|
25 | 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 | 27 | <dl class="overview"> |
|
28 | 28 | <dt>${_('Last revision')}</dt> |
|
29 | 29 | <dd>${h.link_to("r%s:%s" % (c.file.last_changeset.revision,c.file.last_changeset._short), |
@@ -33,8 +33,10 b'' | |||
|
33 | 33 | <dt>${_('Options')}</dt> |
|
34 | 34 | <dd>${h.link_to(_('show source'), |
|
35 | 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 | 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 | 40 | </dd> |
|
39 | 41 | </dl> |
|
40 | 42 | <div id="body" class="codeblock"> |
@@ -43,7 +45,12 b'' | |||
|
43 | 45 | <div class="commit">"${c.file_msg}"</div> |
|
44 | 46 | </div> |
|
45 | 47 | <div class="code-body"> |
|
48 | % if c.file.size < c.file_size_limit: | |
|
46 | 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 | 54 | </div> |
|
48 | 55 | </div> |
|
49 | 56 | </div> |
@@ -9,8 +9,10 b'' | |||
|
9 | 9 | <dt>${_('Options')}</dt> |
|
10 | 10 | <dd>${h.link_to(_('show annotation'), |
|
11 | 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 | 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 | 16 | </dd> |
|
15 | 17 | <dt>${_('History')}</dt> |
|
16 | 18 | <dd> |
@@ -32,7 +34,12 b'' | |||
|
32 | 34 | <div class="commit">"${c.files_list.last_changeset.message}"</div> |
|
33 | 35 | </div> |
|
34 | 36 | <div class="code-body"> |
|
37 | % if c.files_list.size < c.file_size_limit: | |
|
35 | 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 | 43 | </div> |
|
37 | 44 | </div> |
|
38 | 45 |
General Comments 0
You need to be logged in to leave comments.
Login now