diff --git a/pylons_app/__init__.py b/pylons_app/__init__.py --- a/pylons_app/__init__.py +++ b/pylons_app/__init__.py @@ -2,7 +2,7 @@ Hg app, a web based mercurial repository managment based on pylons """ -VERSION = (0, 7, 3, 'beta') +VERSION = (0, 7, 4, 'beta') __version__ = '.'.join((str(each) for each in VERSION[:4])) diff --git a/pylons_app/controllers/changeset.py b/pylons_app/controllers/changeset.py --- a/pylons_app/controllers/changeset.py +++ b/pylons_app/controllers/changeset.py @@ -3,9 +3,10 @@ from pylons import request, response, se from pylons.controllers.util import abort, redirect from pylons_app.lib.auth import LoginRequired from pylons_app.lib.base import BaseController, render -from pylons_app.lib.utils import get_repo_slug from pylons_app.model.hg_model import HgModel +from vcs.utils import diffs as differ import logging +from vcs.nodes import FileNode log = logging.getLogger(__name__) @@ -19,5 +20,23 @@ class ChangesetController(BaseController def index(self, revision): hg_model = HgModel() c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision) - + c.changeset_old = c.changeset.parents[0] + c.changes = [] + + + for node in c.changeset.added: + filenode_old = FileNode(node.path, '') + f_udiff = differ.get_udiff(filenode_old, node) + diff = differ.DiffProcessor(f_udiff).as_html() + c.changes.append(('added', node, diff)) + + for node in c.changeset.changed: + filenode_old = c.changeset_old.get_node(node.path) + f_udiff = differ.get_udiff(filenode_old, node) + diff = differ.DiffProcessor(f_udiff).as_html() + c.changes.append(('changed', node, diff)) + + for node in c.changeset.removed: + c.changes.append(('removed', node, None)) + return render('changeset/changeset.html') diff --git a/pylons_app/lib/middleware/simplehg.py b/pylons_app/lib/middleware/simplehg.py --- a/pylons_app/lib/middleware/simplehg.py +++ b/pylons_app/lib/middleware/simplehg.py @@ -64,7 +64,6 @@ class SimpleHg(object): app = wsgiapplication(self.__make_app) except Exception as e: return HTTPNotFound()(environ, start_response) - action = self.__get_action(environ) #invalidate cache on push if action == 'push': @@ -72,12 +71,13 @@ class SimpleHg(object): if action: username = self.__get_environ_user(environ) - self.__log_user_action(username, action, repo_name) + self.__log_user_action(username, action, repo_name) + return app(environ, start_response) def __make_app(self): hgserve = hgweb(self.repo_path) - return self.load_web_settings(hgserve) + return self.__load_web_settings(hgserve) def __get_environ_user(self, environ): return environ.get('REMOTE_USER') @@ -125,7 +125,7 @@ class SimpleHg(object): invalidate_cache('full_changelog', repo_name) - def load_web_settings(self, hgserve): + def __load_web_settings(self, hgserve): repoui = make_ui(os.path.join(self.repo_path, '.hg', 'hgrc'), False) #set the global ui for hgserve hgserve.repo.ui = self.baseui @@ -135,5 +135,3 @@ class SimpleHg(object): hgserve.repo.ui = repoui return hgserve - - diff --git a/pylons_app/templates/changeset/changeset.html b/pylons_app/templates/changeset/changeset.html --- a/pylons_app/templates/changeset/changeset.html +++ b/pylons_app/templates/changeset/changeset.html @@ -16,18 +16,75 @@ from pylons_app.lib import filters <%def name="page_nav()"> ${self.menu('changelog')} %def> - +<%def name="css()"> + + +%def> <%def name="main()"> -
${filenode}
+ %for change,filenode,diff in c.changes: +${filenode}
- %endfor - %for filenode in c.changeset.removed: -${filenode}
- %endfor -