Show More
@@ -77,21 +77,23 class ChangelogController(BaseRepoContro | |||||
77 |
|
77 | |||
78 |
|
78 | |||
79 | def _graph(self, repo, size, p): |
|
79 | def _graph(self, repo, size, p): | |
80 | revcount = size |
|
80 | """ | |
|
81 | Generates a DAG graph for mercurial | |||
|
82 | ||||
|
83 | :param repo: repo instance | |||
|
84 | :param size: number of commits to show | |||
|
85 | :param p: page number | |||
|
86 | """ | |||
81 | if not repo.revisions or repo.alias == 'git': |
|
87 | if not repo.revisions or repo.alias == 'git': | |
82 | c.jsdata = json.dumps([]) |
|
88 | c.jsdata = json.dumps([]) | |
83 | return |
|
89 | return | |
84 |
|
90 | |||
85 | max_rev = repo.revisions[-1] |
|
91 | revcount = min(repo.size, size) | |
86 |
|
||||
87 | 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)]) | |||
|
94 | rev_end = max(0, rev_start - revcount) | |||
88 |
|
95 | |||
89 | rev_start = repo.revisions[(-1 * offset)] |
|
|||
90 |
|
||||
91 | revcount = min(max_rev, revcount) |
|
|||
92 | rev_end = max(0, rev_start - revcount) |
|
|||
93 | dag = graph_rev(repo._repo, rev_start, rev_end) |
|
96 | dag = graph_rev(repo._repo, rev_start, rev_end) | |
94 |
|
||||
95 | c.dag = tree = list(colored(dag)) |
|
97 | c.dag = tree = list(colored(dag)) | |
96 | data = [] |
|
98 | data = [] | |
97 | for (id, type, ctx, vtx, edges) in tree: |
|
99 | for (id, type, ctx, vtx, edges) in tree: |
General Comments 0
You need to be logged in to leave comments.
Login now