Show More
@@ -1,11 +1,18 b'' | |||||
|
1 | import logging | |||
1 | from pylons import request, response, session, tmpl_context as c, url, config, \ |
|
2 | from pylons import request, response, session, tmpl_context as c, url, config, \ | |
2 | app_globals as g |
|
3 | app_globals as g | |
3 | from pylons.controllers.util import abort, redirect |
|
4 | from pylons.controllers.util import abort, redirect | |
4 | from pylons_app.lib.base import BaseController, render |
|
5 | from pylons_app.lib.base import BaseController, render | |
5 | from pylons_app.lib.utils import get_repo_slug |
|
6 | from pylons_app.lib.utils import get_repo_slug | |
6 | from pylons_app.model.hg_model import HgModel |
|
7 | from pylons_app.model.hg_model import HgModel | |
7 | import logging |
|
|||
8 |
|
8 | |||
|
9 | from mercurial.graphmod import revisions as graph_rev, colored, CHANGESET | |||
|
10 | from pylons_app.lib.filters import age as _age, person | |||
|
11 | from simplejson import dumps | |||
|
12 | from mercurial.node import short | |||
|
13 | from webhelpers.paginate import Page | |||
|
14 | ||||
|
15 | ||||
9 |
|
16 | |||
10 | log = logging.getLogger(__name__) |
|
17 | log = logging.getLogger(__name__) | |
11 |
|
18 | |||
@@ -27,14 +34,11 b' class GraphController(BaseController):' | |||||
27 |
|
34 | |||
28 |
|
35 | |||
29 | def graph(self, repo, size): |
|
36 | def graph(self, repo, size): | |
30 | from mercurial.graphmod import revisions as graph_rev, colored, CHANGESET |
|
|||
31 | from pylons_app.lib.filters import age as _age, person |
|
|||
32 | from simplejson import dumps |
|
|||
33 | from mercurial.node import short |
|
|||
34 | from webhelpers.paginate import Page |
|
|||
35 | revcount = size |
|
37 | revcount = size | |
36 | p = int(request.params.get('page', 1)) |
|
38 | p = int(request.params.get('page', 1)) | |
37 | c.pagination = Page(repo.revisions, page=p, item_count=len(repo.revisions), items_per_page=revcount) |
|
39 | c.pagination = Page(repo.revisions, page=p, item_count=len(repo.revisions), items_per_page=revcount) | |
|
40 | if not repo.revisions:return dumps([]), 0 | |||
|
41 | ||||
38 | max_rev = repo.revisions[-1] |
|
42 | max_rev = repo.revisions[-1] | |
39 | offset = 1 if p == 1 else ((p - 1) * revcount) |
|
43 | offset = 1 if p == 1 else ((p - 1) * revcount) | |
40 | rev_start = repo.revisions[(-1 * offset)] |
|
44 | rev_start = repo.revisions[(-1 * offset)] | |
@@ -42,8 +46,6 b' class GraphController(BaseController):' | |||||
42 |
|
46 | |||
43 | revcount = min(max_rev, revcount) |
|
47 | revcount = min(max_rev, revcount) | |
44 | rev_end = max(0, rev_start - revcount) |
|
48 | rev_end = max(0, rev_start - revcount) | |
45 | print rev_start, rev_end |
|
|||
46 | print 'x' * 100 |
|
|||
47 | dag = graph_rev(repo.repo, rev_start, rev_end) |
|
49 | dag = graph_rev(repo.repo, rev_start, rev_end) | |
48 | tree = list(colored(dag)) |
|
50 | tree = list(colored(dag)) | |
49 | canvasheight = (len(tree) + 1) * bg_height - 27 |
|
51 | canvasheight = (len(tree) + 1) * bg_height - 27 |
General Comments 0
You need to be logged in to leave comments.
Login now