Mercurial > kallithea
diff 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 |
line wrap: on
line diff
--- a/rhodecode/controllers/changelog.py Sun Jun 03 20:35:13 2012 +0200 +++ b/rhodecode/controllers/changelog.py Mon Jun 04 01:21:15 2012 +0200 @@ -26,7 +26,6 @@ import logging import traceback -from mercurial import graphmod from pylons import request, url, session, tmpl_context as c from pylons.controllers.util import redirect from pylons.i18n.translation import _ @@ -36,7 +35,7 @@ from rhodecode.lib.base import BaseRepoController, render from rhodecode.lib.helpers import RepoPage from rhodecode.lib.compat import json - +from rhodecode.lib.graphmod import _colored, _dagwalker from rhodecode.lib.vcs.exceptions import RepositoryError, ChangesetDoesNotExistError log = logging.getLogger(__name__) @@ -117,18 +116,9 @@ data = [] revs = [x.revision for x in collection] - if repo.alias == 'git': - for _ in revs: - vtx = [0, 1] - edges = [[0, 0, 1]] - data.append(['', vtx, edges]) - - elif repo.alias == 'hg': - dag = graphmod.dagwalker(repo._repo, revs) - c.dag = graphmod.colored(dag, repo._repo) - for (id, type, ctx, vtx, edges) in c.dag: - if type != graphmod.CHANGESET: - continue - data.append(['', vtx, edges]) + dag = _dagwalker(repo, revs, repo.alias) + dag = _colored(dag) + for (id, type, ctx, vtx, edges) in dag: + data.append(['', vtx, edges]) c.jsdata = json.dumps(data)