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 %def> @@ -23,12 +23,19 @@