Mercurial > kallithea
comparison rhodecode/controllers/changelog.py @ 1109:41a695e604ba beta
small fixes, and optimization for changelog graph
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 01 Mar 2011 14:14:10 +0100 |
parents | 5cbaeda8ec6f |
children | 1cecc7db3106 |
comparison
equal
deleted
inserted
replaced
1108:899c19b0865c | 1109:41a695e604ba |
---|---|
69 branch_name = request.params.get('branch', None) | 69 branch_name = request.params.get('branch', None) |
70 c.total_cs = len(c.rhodecode_repo) | 70 c.total_cs = len(c.rhodecode_repo) |
71 c.pagination = RepoPage(c.rhodecode_repo, page=p, item_count=c.total_cs, | 71 c.pagination = RepoPage(c.rhodecode_repo, page=p, item_count=c.total_cs, |
72 items_per_page=c.size, branch_name=branch_name) | 72 items_per_page=c.size, branch_name=branch_name) |
73 | 73 |
74 self._graph(c.rhodecode_repo, c.size, p) | 74 self._graph(c.rhodecode_repo, c.total_cs, c.size, p) |
75 | 75 |
76 return render('changelog/changelog.html') | 76 return render('changelog/changelog.html') |
77 | 77 |
78 | 78 |
79 def _graph(self, repo, size, p): | 79 def _graph(self, repo, repo_size, size, p): |
80 """ | 80 """ |
81 Generates a DAG graph for mercurial | 81 Generates a DAG graph for mercurial |
82 | 82 |
83 :param repo: repo instance | 83 :param repo: repo instance |
84 :param size: number of commits to show | 84 :param size: number of commits to show |
86 """ | 86 """ |
87 if not repo.revisions or repo.alias == 'git': | 87 if not repo.revisions or repo.alias == 'git': |
88 c.jsdata = json.dumps([]) | 88 c.jsdata = json.dumps([]) |
89 return | 89 return |
90 | 90 |
91 revcount = min(repo.size, size) | 91 revcount = min(repo_size, size) |
92 offset = 1 if p == 1 else ((p - 1) * revcount + 1) | 92 offset = 1 if p == 1 else ((p - 1) * revcount + 1) |
93 rev_start = repo.revisions.index(repo.revisions[(-1 * offset)]) | 93 rev_start = repo.revisions.index(repo.revisions[(-1 * offset)]) |
94 rev_end = max(0, rev_start - revcount) | 94 rev_end = max(0, rev_start - revcount) |
95 | 95 |
96 dag = graph_rev(repo._repo, rev_start, rev_end) | 96 dag = graph_rev(repo._repo, rev_start, rev_end) |