Mercurial > kallithea
comparison rhodecode/controllers/changelog.py @ 2380:0c7dc3402efa beta
Unified DAG generation for hg and git
- also fixes issue #470
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 04 Jun 2012 01:21:15 +0200 |
parents | 889cda9c2d14 |
children | 91fae60bf2b6 |
comparison
equal
deleted
inserted
replaced
2379:7ac09514a178 | 2380:0c7dc3402efa |
---|---|
24 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 24 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
25 | 25 |
26 import logging | 26 import logging |
27 import traceback | 27 import traceback |
28 | 28 |
29 from mercurial import graphmod | |
30 from pylons import request, url, session, tmpl_context as c | 29 from pylons import request, url, session, tmpl_context as c |
31 from pylons.controllers.util import redirect | 30 from pylons.controllers.util import redirect |
32 from pylons.i18n.translation import _ | 31 from pylons.i18n.translation import _ |
33 | 32 |
34 import rhodecode.lib.helpers as h | 33 import rhodecode.lib.helpers as h |
35 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | 34 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
36 from rhodecode.lib.base import BaseRepoController, render | 35 from rhodecode.lib.base import BaseRepoController, render |
37 from rhodecode.lib.helpers import RepoPage | 36 from rhodecode.lib.helpers import RepoPage |
38 from rhodecode.lib.compat import json | 37 from rhodecode.lib.compat import json |
39 | 38 from rhodecode.lib.graphmod import _colored, _dagwalker |
40 from rhodecode.lib.vcs.exceptions import RepositoryError, ChangesetDoesNotExistError | 39 from rhodecode.lib.vcs.exceptions import RepositoryError, ChangesetDoesNotExistError |
41 | 40 |
42 log = logging.getLogger(__name__) | 41 log = logging.getLogger(__name__) |
43 | 42 |
44 | 43 |
115 return | 114 return |
116 | 115 |
117 data = [] | 116 data = [] |
118 revs = [x.revision for x in collection] | 117 revs = [x.revision for x in collection] |
119 | 118 |
120 if repo.alias == 'git': | 119 dag = _dagwalker(repo, revs, repo.alias) |
121 for _ in revs: | 120 dag = _colored(dag) |
122 vtx = [0, 1] | 121 for (id, type, ctx, vtx, edges) in dag: |
123 edges = [[0, 0, 1]] | 122 data.append(['', vtx, edges]) |
124 data.append(['', vtx, edges]) | |
125 | |
126 elif repo.alias == 'hg': | |
127 dag = graphmod.dagwalker(repo._repo, revs) | |
128 c.dag = graphmod.colored(dag, repo._repo) | |
129 for (id, type, ctx, vtx, edges) in c.dag: | |
130 if type != graphmod.CHANGESET: | |
131 continue | |
132 data.append(['', vtx, edges]) | |
133 | 123 |
134 c.jsdata = json.dumps(data) | 124 c.jsdata = json.dumps(data) |