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): ${branch._ctx.date()|n,filters.age} - ${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))} diff --git a/pylons_app/templates/files/files.html b/pylons_app/templates/files/files.html --- a/pylons_app/templates/files/files.html +++ b/pylons_app/templates/files/files.html @@ -36,7 +36,7 @@ <%include file='files_source.html'/> %endif %else: -

${_('No files')}

+

${_('Go back')} ${_('No files at given path')}: "${c.f_path or "/"}"

%endif diff --git a/pylons_app/templates/files/files_browser.html b/pylons_app/templates/files/files_browser.html --- a/pylons_app/templates/files/files_browser.html +++ b/pylons_app/templates/files/files_browser.html @@ -8,7 +8,7 @@
${h.form(h.url.current())} - ${_('view')}@rev:${h.text('at_rev',value=c.rev_nr,size='5')} + ${_('view')}@rev ${h.submit('view_low','-')}${h.text('at_rev',value=c.rev_nr,size='5')}${h.submit('view_high','+')} ${h.submit('view','view')} ${h.end_form()}
diff --git a/pylons_app/templates/tags/tags.html b/pylons_app/templates/tags/tags.html --- a/pylons_app/templates/tags/tags.html +++ b/pylons_app/templates/tags/tags.html @@ -30,7 +30,6 @@ from pylons_app.lib import filters %for cnt,tag in enumerate(c.repo_tags): ${tag._ctx.date()|n,filters.age} - ${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}