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