# HG changeset patch # User Marcin Kuzminski # Date 1273525965 -7200 # Node ID 3f01d02c2cc63eed7820797c4409348ab7d1f5ce # Parent ea89ac73bef863fc7b31e6ab43935c14560040e5 fixed error when browsing revisions on path that doesn't exist. Fixed files browsing. Fixed templates in branches and tags diff -r ea89ac73bef8 -r 3f01d02c2cc6 pylons_app/controllers/files.py --- a/pylons_app/controllers/files.py Sun May 09 17:35:51 2010 +0200 +++ b/pylons_app/controllers/files.py Mon May 10 23:12:45 2010 +0200 @@ -8,7 +8,7 @@ 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 @@ 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 @@ 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 -r ea89ac73bef8 -r 3f01d02c2cc6 pylons_app/templates/branches/branches.html --- a/pylons_app/templates/branches/branches.html Sun May 09 17:35:51 2010 +0200 +++ b/pylons_app/templates/branches/branches.html Mon May 10 23:12:45 2010 +0200 @@ -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 -r ea89ac73bef8 -r 3f01d02c2cc6 pylons_app/templates/files/files.html --- a/pylons_app/templates/files/files.html Sun May 09 17:35:51 2010 +0200 +++ b/pylons_app/templates/files/files.html Mon May 10 23:12:45 2010 +0200 @@ -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 -r ea89ac73bef8 -r 3f01d02c2cc6 pylons_app/templates/files/files_browser.html --- a/pylons_app/templates/files/files_browser.html Sun May 09 17:35:51 2010 +0200 +++ b/pylons_app/templates/files/files_browser.html Mon May 10 23:12:45 2010 +0200 @@ -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 -r ea89ac73bef8 -r 3f01d02c2cc6 pylons_app/templates/tags/tags.html --- a/pylons_app/templates/tags/tags.html Sun May 09 17:35:51 2010 +0200 +++ b/pylons_app/templates/tags/tags.html Mon May 10 23:12:45 2010 +0200 @@ -30,7 +30,6 @@ %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))}