##// END OF EJS Templates
some changes for #45....
marcink -
r644:c8bd0e6c beta
parent child Browse files
Show More
@@ -27,6 +27,7 b' from pylons.i18n.translation import _'
27 27 from pylons.controllers.util import redirect
28 28 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
29 29 from rhodecode.lib.base import BaseController, render
30 import rhodecode.lib.helpers as h
30 31 from rhodecode.model.hg import HgModel
31 32 from vcs.exceptions import RepositoryError, ChangesetError
32 33 from vcs.nodes import FileNode
@@ -59,8 +60,9 b' class ChangesetController(BaseController'
59 60
60 61 try:
61 62 c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
62 except RepositoryError:
63 except RepositoryError, e:
63 64 log.error(traceback.format_exc())
65 h.flash(str(e), category='warning')
64 66 return redirect(url('home'))
65 67 else:
66 68 try:
@@ -68,7 +68,8 b' class FilesController(BaseController):'
68 68
69 69
70 70 try:
71 cur_rev = repo.get_changeset(revision).revision
71 c.changeset = repo.get_changeset(revision)
72 cur_rev = c.changeset.revision
72 73 prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).raw_id
73 74 next_rev = repo.get_changeset(get_next_rev(cur_rev)).raw_id
74 75
@@ -77,15 +78,19 b' class FilesController(BaseController):'
77 78 c.url_next = url('files_home', repo_name=c.repo_name,
78 79 revision=next_rev, f_path=f_path)
79 80
80 c.changeset = repo.get_changeset(revision)
81
82 c.cur_rev = c.changeset.raw_id
83 c.rev_nr = c.changeset.revision
81 try:
84 82 c.files_list = c.changeset.get_node(f_path)
85 83 c.file_history = self._get_history(repo, c.files_list, f_path)
86 84
87 except (RepositoryError, ChangesetError):
88 c.files_list = None
85 except RepositoryError, e:
86 h.flash(str(e), category='warning')
87 redirect(h.url('files_home', repo_name=repo_name, revision=revision))
88
89 except RepositoryError, e:
90 h.flash(str(e), category='warning')
91 redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
92
93
89 94
90 95 return render('files/files.html')
91 96
@@ -11,7 +11,7 b''
11 11 »
12 12 ${_('files')}
13 13 %if c.files_list:
14 @ R${c.rev_nr}:${h.short_id(c.cur_rev)}
14 @ r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
15 15 %endif
16 16 </%def>
17 17
@@ -24,11 +24,18 b''
24 24 <!-- box / title -->
25 25 <div class="title">
26 26 ${self.breadcrumbs()}
27 <ul class="links">
28 <li>
29 <span style="text-transform: uppercase;"><a href="#">${_('branch')}: ${c.changeset.branch}</a></span>
30 </li>
31 </ul>
27 32 </div>
28 33 <div class="table">
29 34 <div id="files_data">
30 35 %if c.files_list:
31 <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.files_list.path)}</h3>
36 <h3 class="files_location">
37 ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)}
38 </h3>
32 39 %if c.files_list.is_dir():
33 40 <%include file='files_browser.html'/>
34 41 %else:
@@ -10,9 +10,9 b''
10 10 ${h.form(h.url.current())}
11 11 <div class="info_box">
12 12 <span >${_('view')}@rev</span>
13 <a href="${c.url_prev}">&laquo;</a>
14 ${h.text('at_rev',value=c.rev_nr,size=3)}
15 <a href="${c.url_next}">&raquo;</a>
13 <a href="${c.url_prev}" title="${_('previous revision')}">&laquo;</a>
14 ${h.text('at_rev',value=c.changeset.revision,size=3)}
15 <a href="${c.url_next}" title="${_('next revision')}">&raquo;</a>
16 16 ${h.submit('view','view')}
17 17 </div>
18 18 ${h.end_form()}
@@ -33,7 +33,7 b''
33 33 %if c.files_list.parent:
34 34 <tr class="parity0">
35 35 <td>
36 ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.files_list.parent.path),class_="browser-dir")}
36 ${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.files_list.parent.path),class_="browser-dir")}
37 37 </td>
38 38 <td></td>
39 39 <td></td>
@@ -46,7 +46,7 b''
46 46 %for cnt,node in enumerate(c.files_list,1):
47 47 <tr class="parity${cnt%2}">
48 48 <td>
49 ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=node.path),class_=file_class(node))}
49 ${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=node.path),class_=file_class(node))}
50 50 </td>
51 51 <td>
52 52 %if node.is_file():
@@ -60,12 +60,12 b''
60 60 </td>
61 61 <td>
62 62 %if node.is_file():
63 ${node.last_changeset.revision}
63 <span class="tooltip" tooltip_title="${node.last_changeset.raw_id}">${node.last_changeset.revision}</span>
64 64 %endif
65 65 </td>
66 66 <td>
67 67 %if node.is_file():
68 ${h.age(node.last_changeset.date)} - ${node.last_changeset.date}
68 ${node.last_changeset.date} - ${h.age(node.last_changeset.date)} ${_('ago')}
69 69 %endif
70 70 </td>
71 71 <td>
@@ -10,11 +10,11 b''
10 10 <dd>${c.files_list.mimetype}</dd>
11 11 <dt>${_('Options')}</dt>
12 12 <dd>${h.link_to(_('show annotation'),
13 h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
13 h.url('files_annotate_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
14 14 / ${h.link_to(_('show as raw'),
15 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
15 h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
16 16 / ${h.link_to(_('download as raw'),
17 h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
17 h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
18 18 </dd>
19 19 <dt>${_('History')}</dt>
20 20 <dd>
@@ -40,7 +40,7 b''
40 40 ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
41 41 %else:
42 42 ${_('File is to big to display')} ${h.link_to(_('show as raw'),
43 h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
43 h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
44 44 %endif
45 45 </div>
46 46 </div>
General Comments 0
You need to be logged in to leave comments. Login now