Show More
@@ -8,7 +8,7 b' from pylons_app.lib.utils import get_rep' | |||||
8 | from pylons_app.model.hg_model import HgModel |
|
8 | from pylons_app.model.hg_model import HgModel | |
9 | from difflib import unified_diff |
|
9 | from difflib import unified_diff | |
10 | from pylons_app.lib.differ import render_udiff |
|
10 | from pylons_app.lib.differ import render_udiff | |
11 | from vcs.exceptions import RepositoryError |
|
11 | from vcs.exceptions import RepositoryError, ChangesetError | |
12 |
|
12 | |||
13 | log = logging.getLogger(__name__) |
|
13 | log = logging.getLogger(__name__) | |
14 |
|
14 | |||
@@ -18,9 +18,18 b' class FilesController(BaseController):' | |||||
18 | c.repo_name = get_repo_slug(request) |
|
18 | c.repo_name = get_repo_slug(request) | |
19 |
|
19 | |||
20 | def index(self, repo_name, revision, f_path): |
|
20 | def index(self, repo_name, revision, f_path): | |
21 | revision = request.POST.get('at_rev', None) or revision |
|
|||
22 | hg_model = HgModel() |
|
21 | hg_model = HgModel() | |
23 | c.repo = repo = hg_model.get_repo(c.repo_name) |
|
22 | c.repo = repo = hg_model.get_repo(c.repo_name) | |
|
23 | ||||
|
24 | revision = request.POST.get('at_rev', None) or revision | |||
|
25 | if request.POST.get('view_low'): | |||
|
26 | revision = int(revision) - 1 | |||
|
27 | if request.POST.get('view_high'): | |||
|
28 | revision = int(revision) + 1 | |||
|
29 | max_rev = len(c.repo.revisions) - 1 | |||
|
30 | if revision > max_rev: | |||
|
31 | revision = max_rev | |||
|
32 | ||||
24 | c.f_path = f_path |
|
33 | c.f_path = f_path | |
25 | try: |
|
34 | try: | |
26 | c.changeset = repo.get_changeset(repo._get_revision(revision)) |
|
35 | c.changeset = repo.get_changeset(repo._get_revision(revision)) | |
@@ -28,7 +37,7 b' class FilesController(BaseController):' | |||||
28 | c.rev_nr = c.changeset.revision |
|
37 | c.rev_nr = c.changeset.revision | |
29 | c.files_list = c.changeset.get_node(f_path) |
|
38 | c.files_list = c.changeset.get_node(f_path) | |
30 | c.file_history = self._get_history(repo, c.files_list, f_path) |
|
39 | c.file_history = self._get_history(repo, c.files_list, f_path) | |
31 | except RepositoryError: |
|
40 | except (RepositoryError, ChangesetError): | |
32 | c.files_list = None |
|
41 | c.files_list = None | |
33 |
|
42 | |||
34 | return render('files/files.html') |
|
43 | return render('files/files.html') |
@@ -28,7 +28,6 b'' | |||||
28 | %for cnt,branch in enumerate(c.repo_branches): |
|
28 | %for cnt,branch in enumerate(c.repo_branches): | |
29 | <tr class="parity${cnt%2}"> |
|
29 | <tr class="parity${cnt%2}"> | |
30 | <td>${branch._ctx.date()|n,filters.age}</td> |
|
30 | <td>${branch._ctx.date()|n,filters.age}</td> | |
31 | <td></td> |
|
|||
32 | <td> |
|
31 | <td> | |
33 | <span class="logtags"> |
|
32 | <span class="logtags"> | |
34 | <span class="branchtag">${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}</span> |
|
33 | <span class="branchtag">${h.link_to(branch.branch,h.url('changeset_home',repo_name=c.repo_name,revision=branch._short))}</span> |
@@ -36,7 +36,7 b'' | |||||
36 | <%include file='files_source.html'/> |
|
36 | <%include file='files_source.html'/> | |
37 | %endif |
|
37 | %endif | |
38 | %else: |
|
38 | %else: | |
39 | <h2>${_('No files')}</h2> |
|
39 | <h2><a href="#" onClick="javascript:parent.history.back();" target="main">${_('Go back')}</a> ${_('No files at given path')}: "${c.f_path or "/"}" </h2> | |
40 | %endif |
|
40 | %endif | |
41 |
|
41 | |||
42 | </div> |
|
42 | </div> |
@@ -8,7 +8,7 b'' | |||||
8 | <div id="body" class="browserblock"> |
|
8 | <div id="body" class="browserblock"> | |
9 | <div class="browser-header"> |
|
9 | <div class="browser-header"> | |
10 | ${h.form(h.url.current())} |
|
10 | ${h.form(h.url.current())} | |
11 |
<span>${_('view')}@rev |
|
11 | <span>${_('view')}@rev ${h.submit('view_low','-')}${h.text('at_rev',value=c.rev_nr,size='5')}${h.submit('view_high','+')}</span> | |
12 | ${h.submit('view','view')} |
|
12 | ${h.submit('view','view')} | |
13 | ${h.end_form()} |
|
13 | ${h.end_form()} | |
14 | </div> |
|
14 | </div> |
@@ -30,7 +30,6 b' from pylons_app.lib import filters' | |||||
30 | %for cnt,tag in enumerate(c.repo_tags): |
|
30 | %for cnt,tag in enumerate(c.repo_tags): | |
31 | <tr class="parity${cnt%2}"> |
|
31 | <tr class="parity${cnt%2}"> | |
32 | <td>${tag._ctx.date()|n,filters.age}</td> |
|
32 | <td>${tag._ctx.date()|n,filters.age}</td> | |
33 | <td></td> |
|
|||
34 | <td> |
|
33 | <td> | |
35 | <span class="logtags"> |
|
34 | <span class="logtags"> | |
36 | <span class="tagtag">${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}</span> |
|
35 | <span class="tagtag">${h.link_to(tag.tags[-1],h.url('changeset_home',repo_name=c.repo_name,revision=tag._short))}</span> |
General Comments 0
You need to be logged in to leave comments.
Login now