Show More
@@ -59,30 +59,25 b' class FilesController(BaseController):' | |||
|
59 | 59 | c.repo = hg_model.get_repo(c.repo_name) |
|
60 | 60 | revision = request.POST.get('at_rev', None) or revision |
|
61 | 61 | |
|
62 | def get_next_rev(cur): | |
|
63 | max_rev = len(c.repo.revisions) - 1 | |
|
64 | r = cur + 1 | |
|
65 | if r > max_rev: | |
|
66 | r = max_rev | |
|
67 | return r | |
|
68 | ||
|
69 | def get_prev_rev(cur): | |
|
70 | r = cur - 1 | |
|
71 | return r | |
|
72 | ||
|
73 | 62 | c.f_path = f_path |
|
74 | 63 | |
|
75 | ||
|
76 | 64 | try: |
|
77 | 65 | c.changeset = c.repo.get_changeset(revision) |
|
78 | 66 | cur_rev = c.changeset.revision |
|
79 | prev_rev = c.repo.get_changeset(get_prev_rev(cur_rev)).raw_id | |
|
80 | next_rev = c.repo.get_changeset(get_next_rev(cur_rev)).raw_id | |
|
81 | 67 | |
|
82 | c.url_prev = url('files_home', repo_name=c.repo_name, | |
|
68 | try: | |
|
69 | prev_rev = c.repo.get_changeset(cur_rev).prev().raw_id | |
|
70 | c.url_prev = url('files_home', repo_name=c.repo_name, | |
|
83 | 71 | revision=prev_rev, f_path=f_path) |
|
84 | c.url_next = url('files_home', repo_name=c.repo_name, | |
|
72 | except ChangesetDoesNotExistError: | |
|
73 | c.url_prev = '#' | |
|
74 | ||
|
75 | try: | |
|
76 | next_rev = c.repo.get_changeset(cur_rev).next().raw_id | |
|
77 | c.url_next = url('files_home', repo_name=c.repo_name, | |
|
85 | 78 | revision=next_rev, f_path=f_path) |
|
79 | except ChangesetDoesNotExistError: | |
|
80 | c.url_next = '#' | |
|
86 | 81 | |
|
87 | 82 | try: |
|
88 | 83 | c.files_list = c.changeset.get_node(f_path) |
General Comments 0
You need to be logged in to leave comments.
Login now