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 name="css()"> + + + <%def name="main()"> - + + +
+
+
+
${_('Date')}: ${c.changeset.date}
+
${_('Author')}: ${c.changeset.author}
+
+ ${c.changeset.message} +
+
+
+ + ${c.changeset.branch} + %for tag in c.changeset.tags: + ${tag} + %endfor + + %if len(c.changeset.parents)>1: +
+ ${_('merge')} + merge +
+ %endif + %for p_cs in reversed(c.changeset.parents): +
${_('Parrent')} ${p_cs.revision}: ${h.link_to(p_cs.raw_id, + h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)} +
+ %endfor +
+
+
+ +
- %for filenode in c.changeset.added: -

${filenode}

+ %for change,filenode,diff in c.changes: +
${h.link_to(filenode.path,h.url.current(anchor='CHANGE-%s'%filenode.path))}
%endfor - %for filenode in c.changeset.changed: -

${filenode}

- %endfor - %for filenode in c.changeset.removed: -

${filenode}

- %endfor -
+ + + %for change,filenode,diff in c.changes: + %if change !='removed': +
+
+
+
+ + ${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name, + revision=filenode.changeset.raw_id,f_path=filenode.path))} + + + ##» ${h.link_to(_('diff'), + ##h.url.current(diff2=c.diff2,diff1=c.diff1,diff='diff'))} + ##» ${h.link_to(_('raw diff'), + ##h.url.current(diff2=c.diff2,diff1=c.diff1.split(':')[-1],diff='raw'))} + ##» ${h.link_to(_('download diff'), + ##h.url.current(diff2=c.diff2,diff1=c.diff1,diff='download'))} +
+
+
+ ${diff|n} +
+
+ %endif + %endfor + \ No newline at end of file