diff --git a/pylons_app/controllers/files.py b/pylons_app/controllers/files.py --- a/pylons_app/controllers/files.py +++ b/pylons_app/controllers/files.py @@ -8,7 +8,7 @@ from pylons_app.lib.utils import get_rep from pylons_app.model.hg_model import HgModel from difflib import unified_diff from pylons_app.lib.differ import render_udiff -from vcs.exceptions import RepositoryError +from vcs.exceptions import RepositoryError, ChangesetError log = logging.getLogger(__name__) @@ -18,9 +18,18 @@ class FilesController(BaseController): c.repo_name = get_repo_slug(request) def index(self, repo_name, revision, f_path): - revision = request.POST.get('at_rev', None) or revision hg_model = HgModel() c.repo = repo = hg_model.get_repo(c.repo_name) + + revision = request.POST.get('at_rev', None) or revision + if request.POST.get('view_low'): + revision = int(revision) - 1 + if request.POST.get('view_high'): + revision = int(revision) + 1 + max_rev = len(c.repo.revisions) - 1 + if revision > max_rev: + revision = max_rev + c.f_path = f_path try: c.changeset = repo.get_changeset(repo._get_revision(revision)) @@ -28,7 +37,7 @@ class FilesController(BaseController): 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: + except (RepositoryError, ChangesetError): c.files_list = None return render('files/files.html') diff --git a/pylons_app/templates/branches/branches.html b/pylons_app/templates/branches/branches.html --- a/pylons_app/templates/branches/branches.html +++ b/pylons_app/templates/branches/branches.html @@ -28,7 +28,6 @@ %for cnt,branch in enumerate(c.repo_branches):