Show More
@@ -30,7 +30,8 b' def make_map(config):' | |||||
30 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo') |
|
30 | m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo') | |
31 |
|
31 | |||
32 |
|
32 | |||
33 |
map.connect('summary_home', '/{repo_name}/_summary', controller='hg', action='view') |
|
33 | map.connect('summary_home', '/{repo_name}/_summary', controller='hg', action='view') | |
|
34 | ||||
34 | map.connect('hg', '/{path_info:.*}', controller='hg', |
|
35 | map.connect('hg', '/{path_info:.*}', controller='hg', | |
35 | action="view", path_info='/') |
|
36 | action="view", path_info='/') | |
36 |
|
37 |
@@ -38,9 +38,12 b' class HgController(BaseController):' | |||||
38 | def view(self, *args, **kwargs): |
|
38 | def view(self, *args, **kwargs): | |
39 | #TODO: reimplement this not tu use hgwebdir |
|
39 | #TODO: reimplement this not tu use hgwebdir | |
40 |
|
40 | |||
|
41 | #patch for replacing mercurial servings with hg_app servings | |||
41 | vcs_impl = self._get_vcs_impl(request.environ) |
|
42 | vcs_impl = self._get_vcs_impl(request.environ) | |
42 | if vcs_impl: |
|
43 | if vcs_impl: | |
43 | return vcs_impl |
|
44 | return vcs_impl | |
|
45 | ||||
|
46 | ||||
44 | response = g.hgapp(request.environ, self.start_response) |
|
47 | response = g.hgapp(request.environ, self.start_response) | |
45 |
|
48 | |||
46 | http_accept = request.environ.get('HTTP_ACCEPT', False) |
|
49 | http_accept = request.environ.get('HTTP_ACCEPT', False) | |
@@ -79,4 +82,7 b' class HgController(BaseController):' | |||||
79 | hg_model = HgModel() |
|
82 | hg_model = HgModel() | |
80 | c.repo_info = hg_model.get_repo(c.repo_name) |
|
83 | c.repo_info = hg_model.get_repo(c.repo_name) | |
81 | c.repo_changesets = c.repo_info.get_changesets(10) |
|
84 | c.repo_changesets = c.repo_info.get_changesets(10) | |
|
85 | # c.repo_tags = c.repo_info.get_tags(limit=10) | |||
|
86 | # c.repo_branches = c.repo_info.get_branches(limit=10) | |||
82 | return render('/summary.html') |
|
87 | return render('/summary.html') | |
|
88 |
@@ -22,9 +22,6 b' class Globals(object):' | |||||
22 | 'app_globals' variable |
|
22 | 'app_globals' variable | |
23 |
|
23 | |||
24 | """ |
|
24 | """ | |
25 | #two ways of building the merc app i don't know |
|
|||
26 | #the fastest one but belive the wsgiapp is better |
|
|||
27 | #self.hgapp = self.make_web_app() |
|
|||
28 | self.cache = CacheManager(**parse_cache_config_options(config)) |
|
25 | self.cache = CacheManager(**parse_cache_config_options(config)) | |
29 | self.hgapp = wsgiapplication(self.make_web_app) |
|
26 | self.hgapp = wsgiapplication(self.make_web_app) | |
30 |
|
27 |
@@ -1,11 +1,14 b'' | |||||
1 | from mercurial import util |
|
1 | from mercurial import util | |
|
2 | from mercurial.templatefilters import age as _age | |||
2 |
|
3 | |||
|
4 | age = lambda context, x:_age(x) | |||
3 | capitalize = lambda x: x.capitalize() |
|
5 | capitalize = lambda x: x.capitalize() | |
4 | date = lambda x: util.datestr(x) |
|
6 | date = lambda x: util.datestr(x) | |
5 | email = util.email |
|
7 | email = util.email | |
6 | hgdate = lambda x: "%d %d" % x |
|
8 | hgdate = lambda context, x: "%d %d" % x | |
7 | isodate = lambda x: util.datestr(x, '%Y-%m-%d %H:%M %1%2') |
|
9 | isodate = lambda context, x: util.datestr(x, '%Y-%m-%d %H:%M %1%2') | |
8 | isodatesec = lambda x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2') |
|
10 | isodatesec = lambda context, x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2') | |
9 | localdate = lambda x: (x[0], util.makedate()[1]) |
|
11 | localdate = lambda context, x: (x[0], util.makedate()[1]) | |
10 | rfc822date = lambda context, x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2") |
|
12 | rfc822date = lambda context, x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2") | |
11 | rfc3339date = lambda x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2") |
|
13 | rfc3339date = lambda context, x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2") | |
|
14 | time_ago = lambda context, x: util.datestr(_age(x), "%a, %d %b %Y %H:%M:%S %1%2") |
@@ -15,7 +15,6 b' try:' | |||||
15 | from vcs.backends.hg import get_repositories, MercurialRepository |
|
15 | from vcs.backends.hg import get_repositories, MercurialRepository | |
16 | except ImportError: |
|
16 | except ImportError: | |
17 | print 'You have to import vcs module' |
|
17 | print 'You have to import vcs module' | |
18 | from mercurial.templatefilters import age |
|
|||
19 |
|
18 | |||
20 | class HgModel(object): |
|
19 | class HgModel(object): | |
21 | """ |
|
20 | """ | |
@@ -43,7 +42,7 b' class HgModel(object):' | |||||
43 | tmp_d['name_sort'] = tmp_d['name'] |
|
42 | tmp_d['name_sort'] = tmp_d['name'] | |
44 | tmp_d['description'] = mercurial_repo.description |
|
43 | tmp_d['description'] = mercurial_repo.description | |
45 | tmp_d['description_sort'] = tmp_d['description'] |
|
44 | tmp_d['description_sort'] = tmp_d['description'] | |
46 |
tmp_d['last_change'] = |
|
45 | tmp_d['last_change'] = last_change | |
47 | tmp_d['last_change_sort'] = last_change[1] - last_change[0] |
|
46 | tmp_d['last_change_sort'] = last_change[1] - last_change[0] | |
48 | tmp_d['tip'] = str(tip) |
|
47 | tmp_d['tip'] = str(tip) | |
49 | tmp_d['tip_sort'] = tip.rev() |
|
48 | tmp_d['tip_sort'] = tip.rev() | |
@@ -55,6 +54,6 b' class HgModel(object):' | |||||
55 | yield tmp_d |
|
54 | yield tmp_d | |
56 |
|
55 | |||
57 | def get_repo(self, repo_name): |
|
56 | def get_repo(self, repo_name): | |
58 | path = g.paths[0][1] |
|
57 | path = g.paths[0][1].replace('*', '') | |
59 | repo = MercurialRepository(os.path.join(path, repo_name), g.baseui) |
|
58 | repo = MercurialRepository(os.path.join(path, repo_name), baseui=g.baseui) | |
60 | return repo |
|
59 | return repo |
@@ -36,9 +36,9 b'' | |||||
36 | </tr> |
|
36 | </tr> | |
37 | %for cnt,repo in enumerate(c.repos_list): |
|
37 | %for cnt,repo in enumerate(c.repos_list): | |
38 | <tr class="parity${cnt%2}"> |
|
38 | <tr class="parity${cnt%2}"> | |
39 | <td><a href="/${repo['name']}">${repo['name']}</a></td> |
|
39 | <td>${h.link(repo['name'],h.url('summary_home',repo_name=repo['name']))}</td> | |
40 | <td>${repo['description']}</td> |
|
40 | <td>${repo['description']}</td> | |
41 | <td>${repo['last_change']}</td> |
|
41 | <td>${repo['last_change']|n,self.f.age}</td> | |
42 | <td>r${repo['rev']}:<a href="/${repo['name']}/rev/${repo['tip']}/">${repo['tip']}</a></td> |
|
42 | <td>r${repo['rev']}:<a href="/${repo['name']}/rev/${repo['tip']}/">${repo['tip']}</a></td> | |
43 | <td>${repo['contact']}</td> |
|
43 | <td>${repo['contact']}</td> | |
44 | <td class="indexlinks"> |
|
44 | <td class="indexlinks"> |
@@ -40,20 +40,20 b'' | |||||
40 | <dt>contact</dt> |
|
40 | <dt>contact</dt> | |
41 | <dd>${c.repo_info.contact}</dd> |
|
41 | <dd>${c.repo_info.contact}</dd> | |
42 | <dt>last change</dt> |
|
42 | <dt>last change</dt> | |
43 |
<dd>${c.repo_info.last_change|n,self.f. |
|
43 | <dd>${c.repo_info.last_change|n,self.f.time_ago}</dd> | |
44 | </dl> |
|
44 | </dl> | |
45 |
|
45 | |||
46 | <h2><a href="{url}shortlog{sessionvars%urlparameter}">Changes</a></h2> |
|
46 | <h2><a href="{url}shortlog{sessionvars%urlparameter}">Changes</a></h2> | |
47 | <table> |
|
47 | <table> | |
48 | %for cnt,cs in enumerate(c.repo_changesets): |
|
48 | %for cnt,cs in enumerate(c.repo_changesets): | |
49 | <tr class="parity${cnt%2}"> |
|
49 | <tr class="parity${cnt%2}"> | |
50 | <td>${cs.date}</td> |
|
50 | <td>${cs._ctx.date()|n,self.f.time_ago}</td> | |
51 | <td>${cs.author}</td> |
|
51 | <td>${cs.author}</td> | |
52 | <td>${cs.message}</td> |
|
52 | <td>${h.link_to(cs.message,h.url('rev/'+str(cs._ctx)))}</td> | |
53 | <td class="nowrap"> |
|
53 | <td class="nowrap"> | |
54 |
${h.link_to( |
|
54 | ${h.link_to(_('changeset'),h.url('file/'+str(cs._ctx)))} | |
55 | | |
|
55 | | | |
56 |
${h.link_to( |
|
56 | ${h.link_to(_('files'),h.url('file/'+str(cs._ctx)))} | |
57 | </td> |
|
57 | </td> | |
58 | </tr> |
|
58 | </tr> | |
59 | %endfor |
|
59 | %endfor | |
@@ -62,9 +62,11 b'' | |||||
62 | </tr> |
|
62 | </tr> | |
63 | </table> |
|
63 | </table> | |
64 |
|
64 | |||
65 | <h2><a href="{url}tags{sessionvars%urlparameter}">Tags</a></h2> |
|
65 | <h2><a href="{url}tags{sessionvars%urlparameter}">${_('Tags')}</a></h2> | |
66 | <table> |
|
66 | <table> | |
67 | {tags} |
|
67 | %for tag in c.repo_tags: | |
|
68 | ${tag} | |||
|
69 | %endfor | |||
68 | <tr class="light"> |
|
70 | <tr class="light"> | |
69 | <td colspan="3"><a class="list" href="{url}tags{sessionvars%urlparameter}">...</a></td> |
|
71 | <td colspan="3"><a class="list" href="{url}tags{sessionvars%urlparameter}">...</a></td> | |
70 | </tr> |
|
72 | </tr> | |
@@ -72,7 +74,9 b'' | |||||
72 |
|
74 | |||
73 | <h2 class="no-link">Branches</h2> |
|
75 | <h2 class="no-link">Branches</h2> | |
74 | <table> |
|
76 | <table> | |
75 | {branches%branchentry} |
|
77 | %for branch in c.repo_branches: | |
|
78 | ${branch} | |||
|
79 | %endfor | |||
76 | <tr class="light"> |
|
80 | <tr class="light"> | |
77 | <td colspan="4"><a class="list" href="#">...</a></td> |
|
81 | <td colspan="4"><a class="list" href="#">...</a></td> | |
78 | </tr> |
|
82 | </tr> |
General Comments 0
You need to be logged in to leave comments.
Login now