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