Show More
@@ -2,7 +2,7 b'' | |||
|
2 | 2 | Hg app, a web based mercurial repository managment based on pylons |
|
3 | 3 | """ |
|
4 | 4 | |
|
5 |
VERSION = (0, 7, |
|
|
5 | VERSION = (0, 7, 4, 'beta') | |
|
6 | 6 | |
|
7 | 7 | __version__ = '.'.join((str(each) for each in VERSION[:4])) |
|
8 | 8 |
@@ -3,9 +3,10 b' from pylons import request, response, se' | |||
|
3 | 3 | from pylons.controllers.util import abort, redirect |
|
4 | 4 | from pylons_app.lib.auth import LoginRequired |
|
5 | 5 | from pylons_app.lib.base import BaseController, render |
|
6 | from pylons_app.lib.utils import get_repo_slug | |
|
7 | 6 | from pylons_app.model.hg_model import HgModel |
|
7 | from vcs.utils import diffs as differ | |
|
8 | 8 | import logging |
|
9 | from vcs.nodes import FileNode | |
|
9 | 10 | |
|
10 | 11 | |
|
11 | 12 | log = logging.getLogger(__name__) |
@@ -19,5 +20,23 b' class ChangesetController(BaseController' | |||
|
19 | 20 | def index(self, revision): |
|
20 | 21 | hg_model = HgModel() |
|
21 | 22 | c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision) |
|
22 | ||
|
23 | c.changeset_old = c.changeset.parents[0] | |
|
24 | c.changes = [] | |
|
25 | ||
|
26 | ||
|
27 | for node in c.changeset.added: | |
|
28 | filenode_old = FileNode(node.path, '') | |
|
29 | f_udiff = differ.get_udiff(filenode_old, node) | |
|
30 | diff = differ.DiffProcessor(f_udiff).as_html() | |
|
31 | c.changes.append(('added', node, diff)) | |
|
32 | ||
|
33 | for node in c.changeset.changed: | |
|
34 | filenode_old = c.changeset_old.get_node(node.path) | |
|
35 | f_udiff = differ.get_udiff(filenode_old, node) | |
|
36 | diff = differ.DiffProcessor(f_udiff).as_html() | |
|
37 | c.changes.append(('changed', node, diff)) | |
|
38 | ||
|
39 | for node in c.changeset.removed: | |
|
40 | c.changes.append(('removed', node, None)) | |
|
41 | ||
|
23 | 42 | return render('changeset/changeset.html') |
@@ -64,7 +64,6 b' class SimpleHg(object):' | |||
|
64 | 64 | app = wsgiapplication(self.__make_app) |
|
65 | 65 | except Exception as e: |
|
66 | 66 | return HTTPNotFound()(environ, start_response) |
|
67 | ||
|
68 | 67 | action = self.__get_action(environ) |
|
69 | 68 | #invalidate cache on push |
|
70 | 69 | if action == 'push': |
@@ -72,12 +71,13 b' class SimpleHg(object):' | |||
|
72 | 71 | |
|
73 | 72 | if action: |
|
74 | 73 | username = self.__get_environ_user(environ) |
|
75 |
self.__log_user_action(username, action, repo_name) |
|
|
74 | self.__log_user_action(username, action, repo_name) | |
|
75 | ||
|
76 | 76 | return app(environ, start_response) |
|
77 | 77 | |
|
78 | 78 | def __make_app(self): |
|
79 | 79 | hgserve = hgweb(self.repo_path) |
|
80 | return self.load_web_settings(hgserve) | |
|
80 | return self.__load_web_settings(hgserve) | |
|
81 | 81 | |
|
82 | 82 | def __get_environ_user(self, environ): |
|
83 | 83 | return environ.get('REMOTE_USER') |
@@ -125,7 +125,7 b' class SimpleHg(object):' | |||
|
125 | 125 | invalidate_cache('full_changelog', repo_name) |
|
126 | 126 | |
|
127 | 127 | |
|
128 | def load_web_settings(self, hgserve): | |
|
128 | def __load_web_settings(self, hgserve): | |
|
129 | 129 | repoui = make_ui(os.path.join(self.repo_path, '.hg', 'hgrc'), False) |
|
130 | 130 | #set the global ui for hgserve |
|
131 | 131 | hgserve.repo.ui = self.baseui |
@@ -135,5 +135,3 b' class SimpleHg(object):' | |||
|
135 | 135 | hgserve.repo.ui = repoui |
|
136 | 136 | |
|
137 | 137 | return hgserve |
|
138 | ||
|
139 |
@@ -16,18 +16,75 b' from pylons_app.lib import filters' | |||
|
16 | 16 | <%def name="page_nav()"> |
|
17 | 17 | ${self.menu('changelog')} |
|
18 | 18 | </%def> |
|
19 | ||
|
19 | <%def name="css()"> | |
|
20 | <link rel="stylesheet" href="/css/monoblue_custom.css" type="text/css" /> | |
|
21 | <link rel="stylesheet" href="/css/diff.css" type="text/css" /> | |
|
22 | </%def> | |
|
20 | 23 | <%def name="main()"> |
|
21 | <h2 class="no-link no-border">${_('Changeset')}</h2> | |
|
24 | <h2 class="no-link no-border">${_('Changeset')} - r${c.changeset.revision}:${c.changeset.raw_id}</h2> | |
|
25 | ||
|
26 | <div id="changeset_content"> | |
|
27 | <div class="container"> | |
|
28 | <div class="left"> | |
|
29 | <div class="date">${_('Date')}: ${c.changeset.date}</div> | |
|
30 | <div class="author">${_('Author')}: ${c.changeset.author}</div> | |
|
31 | <div class="message"> | |
|
32 | ${c.changeset.message} | |
|
33 | </div> | |
|
34 | </div> | |
|
35 | <div class="right"> | |
|
36 | <span class="logtags"> | |
|
37 | <span class="branchtag">${c.changeset.branch}</span> | |
|
38 | %for tag in c.changeset.tags: | |
|
39 | <span class="tagtag">${tag}</span> | |
|
40 | %endfor | |
|
41 | </span> | |
|
42 | %if len(c.changeset.parents)>1: | |
|
43 | <div class="merge"> | |
|
44 | ${_('merge')} | |
|
45 | <img alt="merge" src="/images/icons/arrow_join.png"> | |
|
46 | </div> | |
|
47 | %endif | |
|
48 | %for p_cs in reversed(c.changeset.parents): | |
|
49 | <div class="parent">${_('Parrent')} ${p_cs.revision}: ${h.link_to(p_cs.raw_id, | |
|
50 | h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)} | |
|
51 | </div> | |
|
52 | %endfor | |
|
53 | </div> | |
|
54 | </div> | |
|
55 | </div> | |
|
56 | ||
|
57 | <div style="clear: both"></div> | |
|
22 | 58 | <div class="cs_files"> |
|
23 |
%for filenode in c.changes |
|
|
24 | <p class="cs_added">${filenode}</p> | |
|
59 | %for change,filenode,diff in c.changes: | |
|
60 | <div class="cs_${change}">${h.link_to(filenode.path,h.url.current(anchor='CHANGE-%s'%filenode.path))}</div> | |
|
25 | 61 | %endfor |
|
26 | %for filenode in c.changeset.changed: | |
|
27 | <p class="cs_changed">${filenode}</p> | |
|
28 | %endfor | |
|
29 | %for filenode in c.changeset.removed: | |
|
30 | <p class="cs_removed">${filenode}</p> | |
|
31 | %endfor | |
|
32 | </div> | |
|
62 | </div> | |
|
63 | ||
|
64 | %for change,filenode,diff in c.changes: | |
|
65 | %if change !='removed': | |
|
66 | <div style="clear:both;height:10px"></div> | |
|
67 | <div id="body" class="diffblock"> | |
|
68 | <div id="${'CHANGE-%s'%filenode.path}" class="code-header"> | |
|
69 | <div> | |
|
70 | <span> | |
|
71 | ${h.link_to_if(change!='removed',filenode.path,h.url('files_home',repo_name=c.repo_name, | |
|
72 | revision=filenode.changeset.raw_id,f_path=filenode.path))} | |
|
73 | </span> | |
|
74 | ||
|
75 | ##» <span style="font-size:77%">${h.link_to(_('diff'), | |
|
76 | ##h.url.current(diff2=c.diff2,diff1=c.diff1,diff='diff'))}</span> | |
|
77 | ##» <span style="font-size:77%">${h.link_to(_('raw diff'), | |
|
78 | ##h.url.current(diff2=c.diff2,diff1=c.diff1.split(':')[-1],diff='raw'))}</span> | |
|
79 | ##» <span style="font-size:77%">${h.link_to(_('download diff'), | |
|
80 | ##h.url.current(diff2=c.diff2,diff1=c.diff1,diff='download'))}</span> | |
|
81 | </div> | |
|
82 | </div> | |
|
83 | <div class="code-body"> | |
|
84 | ${diff|n} | |
|
85 | </div> | |
|
86 | </div> | |
|
87 | %endif | |
|
88 | %endfor | |
|
89 | ||
|
33 | 90 | </%def> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now