diff --git a/rhodecode/controllers/changeset.py b/rhodecode/controllers/changeset.py --- a/rhodecode/controllers/changeset.py +++ b/rhodecode/controllers/changeset.py @@ -27,6 +27,7 @@ from pylons.i18n.translation import _ from pylons.controllers.util import redirect from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator from rhodecode.lib.base import BaseController, render +import rhodecode.lib.helpers as h from rhodecode.model.hg import HgModel from vcs.exceptions import RepositoryError, ChangesetError from vcs.nodes import FileNode @@ -59,8 +60,9 @@ class ChangesetController(BaseController try: c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision) - except RepositoryError: + except RepositoryError, e: log.error(traceback.format_exc()) + h.flash(str(e), category='warning') return redirect(url('home')) else: try: diff --git a/rhodecode/controllers/files.py b/rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py +++ b/rhodecode/controllers/files.py @@ -68,24 +68,29 @@ class FilesController(BaseController): try: - cur_rev = repo.get_changeset(revision).revision + c.changeset = repo.get_changeset(revision) + cur_rev = c.changeset.revision prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).raw_id next_rev = repo.get_changeset(get_next_rev(cur_rev)).raw_id c.url_prev = url('files_home', repo_name=c.repo_name, revision=prev_rev, f_path=f_path) c.url_next = url('files_home', repo_name=c.repo_name, - revision=next_rev, f_path=f_path) + revision=next_rev, f_path=f_path) - c.changeset = repo.get_changeset(revision) + try: + c.files_list = c.changeset.get_node(f_path) + c.file_history = self._get_history(repo, c.files_list, f_path) - c.cur_rev = c.changeset.raw_id - c.rev_nr = c.changeset.revision - c.files_list = c.changeset.get_node(f_path) - c.file_history = self._get_history(repo, c.files_list, f_path) + except RepositoryError, e: + h.flash(str(e), category='warning') + redirect(h.url('files_home', repo_name=repo_name, revision=revision)) - except (RepositoryError, ChangesetError): - c.files_list = None + except RepositoryError, e: + h.flash(str(e), category='warning') + redirect(h.url('files_home', repo_name=repo_name, revision='tip')) + + return render('files/files.html') diff --git a/rhodecode/templates/files/files.html b/rhodecode/templates/files/files.html --- a/rhodecode/templates/files/files.html +++ b/rhodecode/templates/files/files.html @@ -11,7 +11,7 @@ » ${_('files')} %if c.files_list: - @ R${c.rev_nr}:${h.short_id(c.cur_rev)} + @ r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} %endif @@ -23,12 +23,19 @@
- ${self.breadcrumbs()} + ${self.breadcrumbs()} +
%if c.files_list: -

${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.files_list.path)}

+

+ ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)} +

%if c.files_list.is_dir(): <%include file='files_browser.html'/> %else: diff --git a/rhodecode/templates/files/files_browser.html b/rhodecode/templates/files/files_browser.html --- a/rhodecode/templates/files/files_browser.html +++ b/rhodecode/templates/files/files_browser.html @@ -10,9 +10,9 @@ ${h.form(h.url.current())}
${_('view')}@rev - « - ${h.text('at_rev',value=c.rev_nr,size=3)} - » + « + ${h.text('at_rev',value=c.changeset.revision,size=3)} + » ${h.submit('view','view')}
${h.end_form()} @@ -33,7 +33,7 @@ %if c.files_list.parent: - ${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")} + ${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")} @@ -46,7 +46,7 @@ %for cnt,node in enumerate(c.files_list,1): - ${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))} + ${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))} %if node.is_file(): @@ -60,12 +60,12 @@ %if node.is_file(): - ${node.last_changeset.revision} + ${node.last_changeset.revision} %endif %if node.is_file(): - ${h.age(node.last_changeset.date)} - ${node.last_changeset.date} + ${node.last_changeset.date} - ${h.age(node.last_changeset.date)} ${_('ago')} %endif diff --git a/rhodecode/templates/files/files_source.html b/rhodecode/templates/files/files_source.html --- a/rhodecode/templates/files/files_source.html +++ b/rhodecode/templates/files/files_source.html @@ -10,11 +10,11 @@
${c.files_list.mimetype}
${_('Options')}
${h.link_to(_('show annotation'), - h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} + h.url('files_annotate_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))} / ${h.link_to(_('show as raw'), - h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} + h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))} / ${h.link_to(_('download as raw'), - h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} + h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
${_('History')}
@@ -40,7 +40,7 @@ ${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")} %else: ${_('File is to big to display')} ${h.link_to(_('show as raw'), - h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))} + h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))} %endif