Show More
@@ -1,37 +1,38 b'' | |||||
1 | """Routes configuration |
|
1 | """Routes configuration | |
2 |
|
2 | |||
3 | The more specific and detailed routes should be defined first so they |
|
3 | The more specific and detailed routes should be defined first so they | |
4 | may take precedent over the more generic routes. For more information |
|
4 | may take precedent over the more generic routes. For more information | |
5 | refer to the routes manual at http://routes.groovie.org/docs/ |
|
5 | refer to the routes manual at http://routes.groovie.org/docs/ | |
6 | """ |
|
6 | """ | |
7 | from routes import Mapper |
|
7 | from routes import Mapper | |
8 |
|
8 | |||
9 | def make_map(config): |
|
9 | def make_map(config): | |
10 | """Create, configure and return the routes Mapper""" |
|
10 | """Create, configure and return the routes Mapper""" | |
11 | map = Mapper(directory=config['pylons.paths']['controllers'], |
|
11 | map = Mapper(directory=config['pylons.paths']['controllers'], | |
12 | always_scan=config['debug']) |
|
12 | always_scan=config['debug']) | |
13 | map.minimization = False |
|
13 | map.minimization = False | |
14 | map.explicit = False |
|
14 | map.explicit = False | |
15 |
|
15 | |||
16 | # The ErrorController route (handles 404/500 error pages); it should |
|
16 | # The ErrorController route (handles 404/500 error pages); it should | |
17 | # likely stay at the top, ensuring it can always be resolved |
|
17 | # likely stay at the top, ensuring it can always be resolved | |
18 | map.connect('/error/{action}', controller='error') |
|
18 | map.connect('/error/{action}', controller='error') | |
19 | map.connect('/error/{action}/{id}', controller='error') |
|
19 | map.connect('/error/{action}/{id}', controller='error') | |
20 |
|
20 | |||
21 | # CUSTOM ROUTES HERE |
|
21 | # CUSTOM ROUTES HERE | |
22 | map.connect('hg_home', '/', controller='hg', action='index') |
|
22 | map.connect('hg_home', '/', controller='hg', action='index') | |
23 |
|
23 | |||
24 | map.resource('repo', 'repos', path_prefix='/_admin') |
|
24 | map.resource('repo', 'repos', path_prefix='/_admin') | |
25 | map.resource('user', 'users', path_prefix='/_admin') |
|
25 | map.resource('user', 'users', path_prefix='/_admin') | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | with map.submapper(path_prefix='/_admin', controller='admin') as m: |
|
28 | with map.submapper(path_prefix='/_admin', controller='admin') as m: | |
29 | m.connect('admin_home', '/', action='index')#main page |
|
29 | m.connect('admin_home', '/', action='index')#main page | |
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 | |||
37 | return map |
|
38 | return map |
@@ -1,82 +1,88 b'' | |||||
1 | #!/usr/bin/python |
|
1 | #!/usr/bin/python | |
2 | # -*- coding: utf-8 -*- |
|
2 | # -*- coding: utf-8 -*- | |
3 | import logging |
|
3 | import logging | |
4 | from pylons import tmpl_context as c, app_globals as g, session, request, config |
|
4 | from pylons import tmpl_context as c, app_globals as g, session, request, config | |
5 | from pylons_app.lib import helpers as h |
|
5 | from pylons_app.lib import helpers as h | |
6 | from pylons_app.lib.base import BaseController, render |
|
6 | from pylons_app.lib.base import BaseController, render | |
7 | from mako.template import Template |
|
7 | from mako.template import Template | |
8 | from pylons.controllers.util import abort |
|
8 | from pylons.controllers.util import abort | |
9 |
|
9 | |||
10 | from operator import itemgetter |
|
10 | from operator import itemgetter | |
11 | from pylons_app.model.hg_model import HgModel |
|
11 | from pylons_app.model.hg_model import HgModel | |
12 | log = logging.getLogger(__name__) |
|
12 | log = logging.getLogger(__name__) | |
13 |
|
13 | |||
14 | class HgController(BaseController): |
|
14 | class HgController(BaseController): | |
15 |
|
15 | |||
16 | def __before__(self): |
|
16 | def __before__(self): | |
17 | c.repos_prefix = config['repos_name'] |
|
17 | c.repos_prefix = config['repos_name'] | |
18 | c.staticurl = g.statics |
|
18 | c.staticurl = g.statics | |
19 |
|
19 | |||
20 | def index(self): |
|
20 | def index(self): | |
21 | hg_model = HgModel() |
|
21 | hg_model = HgModel() | |
22 | c.repos_list = list(hg_model.get_repos()) |
|
22 | c.repos_list = list(hg_model.get_repos()) | |
23 | c.current_sort = request.GET.get('sort', 'name') |
|
23 | c.current_sort = request.GET.get('sort', 'name') | |
24 |
|
24 | |||
25 | cs = c.current_sort |
|
25 | cs = c.current_sort | |
26 | c.cs_slug = cs.replace('-', '') |
|
26 | c.cs_slug = cs.replace('-', '') | |
27 | sortables = ['name', 'description', 'last_change', 'tip', 'contact'] |
|
27 | sortables = ['name', 'description', 'last_change', 'tip', 'contact'] | |
28 |
|
28 | |||
29 | if cs and c.cs_slug in sortables: |
|
29 | if cs and c.cs_slug in sortables: | |
30 | sort_key = c.cs_slug + '_sort' |
|
30 | sort_key = c.cs_slug + '_sort' | |
31 | if cs.startswith('-'): |
|
31 | if cs.startswith('-'): | |
32 | c.repos_list.sort(key=itemgetter(sort_key), reverse=True) |
|
32 | c.repos_list.sort(key=itemgetter(sort_key), reverse=True) | |
33 | else: |
|
33 | else: | |
34 | c.repos_list.sort(key=itemgetter(sort_key), reverse=False) |
|
34 | c.repos_list.sort(key=itemgetter(sort_key), reverse=False) | |
35 |
|
35 | |||
36 | return render('/index.html') |
|
36 | return render('/index.html') | |
37 |
|
37 | |||
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) | |
47 | if not http_accept: |
|
50 | if not http_accept: | |
48 | return abort(status_code=400, detail='no http accept in header') |
|
51 | return abort(status_code=400, detail='no http accept in header') | |
49 |
|
52 | |||
50 | #for mercurial protocols and raw files we can't wrap into mako |
|
53 | #for mercurial protocols and raw files we can't wrap into mako | |
51 | if http_accept.find("mercurial") != -1 or \ |
|
54 | if http_accept.find("mercurial") != -1 or \ | |
52 | request.environ['PATH_INFO'].find('raw-file') != -1: |
|
55 | request.environ['PATH_INFO'].find('raw-file') != -1: | |
53 | return response |
|
56 | return response | |
54 | try: |
|
57 | try: | |
55 | tmpl = u''.join(response) |
|
58 | tmpl = u''.join(response) | |
56 | template = Template(tmpl, lookup=request.environ['pylons.pylons']\ |
|
59 | template = Template(tmpl, lookup=request.environ['pylons.pylons']\ | |
57 | .config['pylons.app_globals'].mako_lookup) |
|
60 | .config['pylons.app_globals'].mako_lookup) | |
58 |
|
61 | |||
59 | except (RuntimeError, UnicodeDecodeError): |
|
62 | except (RuntimeError, UnicodeDecodeError): | |
60 | log.info('disabling unicode due to encoding error') |
|
63 | log.info('disabling unicode due to encoding error') | |
61 | response = g.hgapp(request.environ, self.start_response) |
|
64 | response = g.hgapp(request.environ, self.start_response) | |
62 | tmpl = ''.join(response) |
|
65 | tmpl = ''.join(response) | |
63 | template = Template(tmpl, lookup=request.environ['pylons.pylons']\ |
|
66 | template = Template(tmpl, lookup=request.environ['pylons.pylons']\ | |
64 | .config['pylons.app_globals'].mako_lookup, disable_unicode=True) |
|
67 | .config['pylons.app_globals'].mako_lookup, disable_unicode=True) | |
65 |
|
68 | |||
66 |
|
69 | |||
67 | return template.render(g=g, c=c, session=session, h=h) |
|
70 | return template.render(g=g, c=c, session=session, h=h) | |
68 |
|
71 | |||
69 |
|
72 | |||
70 |
|
73 | |||
71 |
|
74 | |||
72 | def _get_vcs_impl(self, environ): |
|
75 | def _get_vcs_impl(self, environ): | |
73 | path_info = environ['PATH_INFO'] |
|
76 | path_info = environ['PATH_INFO'] | |
74 | c.repo_name = path_info.split('/')[-2] |
|
77 | c.repo_name = path_info.split('/')[-2] | |
75 | action = path_info.split('/')[-1] |
|
78 | action = path_info.split('/')[-1] | |
76 | if not action.startswith('_'): |
|
79 | if not action.startswith('_'): | |
77 | return False |
|
80 | return False | |
78 | else: |
|
81 | else: | |
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 |
@@ -1,77 +1,74 b'' | |||||
1 | """The application's Globals object""" |
|
1 | """The application's Globals object""" | |
2 | #uncomment the following if you want to serve a single repo |
|
2 | #uncomment the following if you want to serve a single repo | |
3 | #from mercurial.hgweb.hgweb_mod import hgweb |
|
3 | #from mercurial.hgweb.hgweb_mod import hgweb | |
4 | from mercurial.hgweb.hgwebdir_mod import hgwebdir |
|
4 | from mercurial.hgweb.hgwebdir_mod import hgwebdir | |
5 | from mercurial import templater |
|
5 | from mercurial import templater | |
6 | from mercurial.hgweb.request import wsgiapplication |
|
6 | from mercurial.hgweb.request import wsgiapplication | |
7 | from mercurial import ui, config |
|
7 | from mercurial import ui, config | |
8 | import os |
|
8 | import os | |
9 | from beaker.cache import CacheManager |
|
9 | from beaker.cache import CacheManager | |
10 | from beaker.util import parse_cache_config_options |
|
10 | from beaker.util import parse_cache_config_options | |
11 |
|
11 | |||
12 | class Globals(object): |
|
12 | class Globals(object): | |
13 |
|
13 | |||
14 | """Globals acts as a container for objects available throughout the |
|
14 | """Globals acts as a container for objects available throughout the | |
15 | life of the application |
|
15 | life of the application | |
16 |
|
16 | |||
17 | """ |
|
17 | """ | |
18 |
|
18 | |||
19 | def __init__(self, config): |
|
19 | def __init__(self, config): | |
20 | """One instance of Globals is created during application |
|
20 | """One instance of Globals is created during application | |
21 | initialization and is available during requests via the |
|
21 | initialization and is available during requests via the | |
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 | |||
31 | def make_web_app(self): |
|
28 | def make_web_app(self): | |
32 | repos = "hgwebdir.config" |
|
29 | repos = "hgwebdir.config" | |
33 | baseui = ui.ui() |
|
30 | baseui = ui.ui() | |
34 | cfg = config.config() |
|
31 | cfg = config.config() | |
35 | cfg.read(repos) |
|
32 | cfg.read(repos) | |
36 | paths = cfg.items('paths') |
|
33 | paths = cfg.items('paths') | |
37 | self.paths = paths |
|
34 | self.paths = paths | |
38 | self.check_repo_dir(paths) |
|
35 | self.check_repo_dir(paths) | |
39 |
|
36 | |||
40 | self.set_statics(cfg) |
|
37 | self.set_statics(cfg) | |
41 |
|
38 | |||
42 | for k, v in cfg.items('web'): |
|
39 | for k, v in cfg.items('web'): | |
43 | baseui.setconfig('web', k, v) |
|
40 | baseui.setconfig('web', k, v) | |
44 | #magic trick to make our custom template dir working |
|
41 | #magic trick to make our custom template dir working | |
45 | templater.path.append(cfg.get('web', 'templates', None)) |
|
42 | templater.path.append(cfg.get('web', 'templates', None)) | |
46 | self.baseui = baseui |
|
43 | self.baseui = baseui | |
47 | #baseui.setconfig('web', 'description', '') |
|
44 | #baseui.setconfig('web', 'description', '') | |
48 | #baseui.setconfig('web', 'name', '') |
|
45 | #baseui.setconfig('web', 'name', '') | |
49 | #baseui.setconfig('web', 'contact', '') |
|
46 | #baseui.setconfig('web', 'contact', '') | |
50 | #baseui.setconfig('web', 'allow_archive', '') |
|
47 | #baseui.setconfig('web', 'allow_archive', '') | |
51 | #baseui.setconfig('web', 'style', 'monoblue_plain') |
|
48 | #baseui.setconfig('web', 'style', 'monoblue_plain') | |
52 | #baseui.setconfig('web', 'baseurl', '') |
|
49 | #baseui.setconfig('web', 'baseurl', '') | |
53 | #baseui.setconfig('web', 'staticurl', '') |
|
50 | #baseui.setconfig('web', 'staticurl', '') | |
54 |
|
51 | |||
55 | hgwebapp = hgwebdir(paths, baseui=baseui) |
|
52 | hgwebapp = hgwebdir(paths, baseui=baseui) | |
56 | return hgwebapp |
|
53 | return hgwebapp | |
57 |
|
54 | |||
58 |
|
55 | |||
59 | def set_statics(self, cfg): |
|
56 | def set_statics(self, cfg): | |
60 | ''' |
|
57 | ''' | |
61 | set's the statics for use in mako templates |
|
58 | set's the statics for use in mako templates | |
62 | @param cfg: |
|
59 | @param cfg: | |
63 | ''' |
|
60 | ''' | |
64 | self.statics = cfg.get('web', 'staticurl', '/static') |
|
61 | self.statics = cfg.get('web', 'staticurl', '/static') | |
65 | if not self.statics.endswith('/'): |
|
62 | if not self.statics.endswith('/'): | |
66 | self.statics += '/' |
|
63 | self.statics += '/' | |
67 |
|
64 | |||
68 |
|
65 | |||
69 | def check_repo_dir(self, paths): |
|
66 | def check_repo_dir(self, paths): | |
70 | repos_path = paths[0][1].split('/') |
|
67 | repos_path = paths[0][1].split('/') | |
71 | if repos_path[-1] in ['*', '**']: |
|
68 | if repos_path[-1] in ['*', '**']: | |
72 | repos_path = repos_path[:-1] |
|
69 | repos_path = repos_path[:-1] | |
73 | if repos_path[0] != '/': |
|
70 | if repos_path[0] != '/': | |
74 | repos_path[0] = '/' |
|
71 | repos_path[0] = '/' | |
75 | if not os.path.isdir(os.path.join(*repos_path)): |
|
72 | if not os.path.isdir(os.path.join(*repos_path)): | |
76 | raise Exception('Not a valid repository in %s' % paths[0][1]) |
|
73 | raise Exception('Not a valid repository in %s' % paths[0][1]) | |
77 |
|
74 |
@@ -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") |
@@ -1,60 +1,59 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # encoding: utf-8 |
|
2 | # encoding: utf-8 | |
3 | # |
|
3 | # | |
4 | # Copyright (c) 2010 marcink. All rights reserved. |
|
4 | # Copyright (c) 2010 marcink. All rights reserved. | |
5 | # |
|
5 | # | |
6 | ''' |
|
6 | ''' | |
7 | Created on Apr 9, 2010 |
|
7 | Created on Apr 9, 2010 | |
8 |
|
8 | |||
9 | @author: marcink |
|
9 | @author: marcink | |
10 | ''' |
|
10 | ''' | |
11 | import os |
|
11 | import os | |
12 | from pylons import tmpl_context as c, app_globals as g, session, request, config |
|
12 | from pylons import tmpl_context as c, app_globals as g, session, request, config | |
13 | from pylons.controllers.util import abort |
|
13 | from pylons.controllers.util import abort | |
14 | try: |
|
14 | 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 | """ | |
22 | Mercurial Model |
|
21 | Mercurial Model | |
23 | """ |
|
22 | """ | |
24 |
|
23 | |||
25 |
|
24 | |||
26 | def __init__(self): |
|
25 | def __init__(self): | |
27 | """ |
|
26 | """ | |
28 | Constructor |
|
27 | Constructor | |
29 | """ |
|
28 | """ | |
30 | pass |
|
29 | pass | |
31 |
|
30 | |||
32 | def get_repos(self): |
|
31 | def get_repos(self): | |
33 | for mercurial_repo in get_repositories(g.paths[0][0], g.paths[0][1], g.baseui): |
|
32 | for mercurial_repo in get_repositories(g.paths[0][0], g.paths[0][1], g.baseui): | |
34 |
|
33 | |||
35 | if mercurial_repo._get_hidden(): |
|
34 | if mercurial_repo._get_hidden(): | |
36 | #skip hidden web repository |
|
35 | #skip hidden web repository | |
37 | continue |
|
36 | continue | |
38 |
|
37 | |||
39 | last_change = mercurial_repo.last_change |
|
38 | last_change = mercurial_repo.last_change | |
40 | tip = mercurial_repo.repo.changectx('tip') |
|
39 | tip = mercurial_repo.repo.changectx('tip') | |
41 | tmp_d = {} |
|
40 | tmp_d = {} | |
42 | tmp_d['name'] = mercurial_repo.name |
|
41 | tmp_d['name'] = mercurial_repo.name | |
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() | |
50 | tmp_d['rev'] = tip.rev() |
|
49 | tmp_d['rev'] = tip.rev() | |
51 | tmp_d['contact'] = mercurial_repo.contact |
|
50 | tmp_d['contact'] = mercurial_repo.contact | |
52 | tmp_d['contact_sort'] = tmp_d['contact'] |
|
51 | tmp_d['contact_sort'] = tmp_d['contact'] | |
53 | tmp_d['repo_archives'] = mercurial_repo._get_archive_list() |
|
52 | tmp_d['repo_archives'] = mercurial_repo._get_archive_list() | |
54 |
|
53 | |||
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 |
@@ -1,58 +1,58 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 |
|
2 | |||
3 | <%inherit file="base/base.html"/> |
|
3 | <%inherit file="base/base.html"/> | |
4 | <%def name="title()"> |
|
4 | <%def name="title()"> | |
5 | ${c.repos_prefix} Mercurial Repositories |
|
5 | ${c.repos_prefix} Mercurial Repositories | |
6 | </%def> |
|
6 | </%def> | |
7 | <%def name="breadcrumbs()"> |
|
7 | <%def name="breadcrumbs()"> | |
8 | ${c.repos_prefix} Mercurial Repositories |
|
8 | ${c.repos_prefix} Mercurial Repositories | |
9 | </%def> |
|
9 | </%def> | |
10 | <%def name="page_nav()"> |
|
10 | <%def name="page_nav()"> | |
11 | <li class="current">${_('Home')}</li> |
|
11 | <li class="current">${_('Home')}</li> | |
12 | <li>${h.link_to(u'Admin',h.url('admin_home'))}</li> |
|
12 | <li>${h.link_to(u'Admin',h.url('admin_home'))}</li> | |
13 | </%def> |
|
13 | </%def> | |
14 | <%def name="main()"> |
|
14 | <%def name="main()"> | |
15 | <%def name="get_sort(name)"> |
|
15 | <%def name="get_sort(name)"> | |
16 | <%name_slug = name.lower().replace(' ','_') %> |
|
16 | <%name_slug = name.lower().replace(' ','_') %> | |
17 | %if name_slug == c.cs_slug: |
|
17 | %if name_slug == c.cs_slug: | |
18 | <span style="font-weight: bold;color:#006699">${name}</span> |
|
18 | <span style="font-weight: bold;color:#006699">${name}</span> | |
19 | %else: |
|
19 | %else: | |
20 | <span style="font-weight: bold">${name}</span> |
|
20 | <span style="font-weight: bold">${name}</span> | |
21 | %endif |
|
21 | %endif | |
22 |
|
22 | |||
23 | <a href="?sort=${name_slug}">↓</a> |
|
23 | <a href="?sort=${name_slug}">↓</a> | |
24 | <a href="?sort=-${name_slug}">↑</a> |
|
24 | <a href="?sort=-${name_slug}">↑</a> | |
25 |
|
25 | |||
26 | </%def> |
|
26 | </%def> | |
27 | <table> |
|
27 | <table> | |
28 | <tr> |
|
28 | <tr> | |
29 | <td>${get_sort(_('Name'))}</td> |
|
29 | <td>${get_sort(_('Name'))}</td> | |
30 | <td>${get_sort(_('Description'))}</td> |
|
30 | <td>${get_sort(_('Description'))}</td> | |
31 | <td>${get_sort(_('Last change'))}</td> |
|
31 | <td>${get_sort(_('Last change'))}</td> | |
32 | <td>${get_sort(_('Tip'))}</td> |
|
32 | <td>${get_sort(_('Tip'))}</td> | |
33 | <td>${get_sort(_('Contact'))}</td> |
|
33 | <td>${get_sort(_('Contact'))}</td> | |
34 | <td></td> |
|
34 | <td></td> | |
35 | <td></td> |
|
35 | <td></td> | |
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"> | |
45 | %for archive in repo['repo_archives']: |
|
45 | %for archive in repo['repo_archives']: | |
46 | <a href="/${repo['name']}/archive/${archive['node']}${archive['extension']}">${archive['type']}</a> |
|
46 | <a href="/${repo['name']}/archive/${archive['node']}${archive['extension']}">${archive['type']}</a> | |
47 | %endfor |
|
47 | %endfor | |
48 | </td> |
|
48 | </td> | |
49 | <td> |
|
49 | <td> | |
50 | <div class="rss_logo"> |
|
50 | <div class="rss_logo"> | |
51 | <a href="/${repo['name']}/rss-log">RSS</a> |
|
51 | <a href="/${repo['name']}/rss-log">RSS</a> | |
52 | <a href="/${repo['name']}/atom-log">Atom</a> |
|
52 | <a href="/${repo['name']}/atom-log">Atom</a> | |
53 | </div> |
|
53 | </div> | |
54 | </td> |
|
54 | </td> | |
55 | </tr> |
|
55 | </tr> | |
56 | %endfor |
|
56 | %endfor | |
57 | </table> |
|
57 | </table> | |
58 | </%def> |
|
58 | </%def> |
@@ -1,81 +1,85 b'' | |||||
1 | <%inherit file="base/base.html"/> |
|
1 | <%inherit file="base/base.html"/> | |
2 |
|
2 | |||
3 | <%def name="title()"> |
|
3 | <%def name="title()"> | |
4 | ${_('Repository managment')} |
|
4 | ${_('Repository managment')} | |
5 | </%def> |
|
5 | </%def> | |
6 | <%def name="breadcrumbs()"> |
|
6 | <%def name="breadcrumbs()"> | |
7 | ${h.link_to(u'Home',h.url('/'))} |
|
7 | ${h.link_to(u'Home',h.url('/'))} | |
8 | / |
|
8 | / | |
9 | ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))} |
|
9 | ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))} | |
10 | / |
|
10 | / | |
11 | ${_('summary')} |
|
11 | ${_('summary')} | |
12 | </%def> |
|
12 | </%def> | |
13 | <%def name="page_nav()"> |
|
13 | <%def name="page_nav()"> | |
14 | <form action="{url}log"> |
|
14 | <form action="{url}log"> | |
15 | {sessionvars%hiddenformentry} |
|
15 | {sessionvars%hiddenformentry} | |
16 | <dl class="search"> |
|
16 | <dl class="search"> | |
17 | <dt><label>Search: </label></dt> |
|
17 | <dt><label>Search: </label></dt> | |
18 | <dd><input type="text" name="rev" /></dd> |
|
18 | <dd><input type="text" name="rev" /></dd> | |
19 | </dl> |
|
19 | </dl> | |
20 | </form> |
|
20 | </form> | |
21 |
|
21 | |||
22 | <ul class="page-nav"> |
|
22 | <ul class="page-nav"> | |
23 | <li class="current">summary</li> |
|
23 | <li class="current">summary</li> | |
24 | <li><a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a></li> |
|
24 | <li><a href="{url}shortlog{sessionvars%urlparameter}">shortlog</a></li> | |
25 | <li><a href="{url}log{sessionvars%urlparameter}">changelog</a></li> |
|
25 | <li><a href="{url}log{sessionvars%urlparameter}">changelog</a></li> | |
26 | <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> |
|
26 | <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> | |
27 | <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> |
|
27 | <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> | |
28 | <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> |
|
28 | <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> | |
29 | <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li> |
|
29 | <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li> | |
30 | </ul> |
|
30 | </ul> | |
31 | </%def> |
|
31 | </%def> | |
32 | <%def name="main()"> |
|
32 | <%def name="main()"> | |
33 |
|
33 | |||
34 | <h2 class="no-link no-border">${_('Mercurial Repository Overview')}</h2> |
|
34 | <h2 class="no-link no-border">${_('Mercurial Repository Overview')}</h2> | |
35 | <dl class="overview"> |
|
35 | <dl class="overview"> | |
36 | <dt>name</dt> |
|
36 | <dt>name</dt> | |
37 | <dd>${c.repo_info.name}</dd> |
|
37 | <dd>${c.repo_info.name}</dd> | |
38 | <dt>description</dt> |
|
38 | <dt>description</dt> | |
39 | <dd>${c.repo_info.description}</dd> |
|
39 | <dd>${c.repo_info.description}</dd> | |
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 | |
60 | <tr class="light"> |
|
60 | <tr class="light"> | |
61 | <td colspan="4"><a class="list" href="{url}shortlog{sessionvars%urlparameter}">...</a></td> |
|
61 | <td colspan="4"><a class="list" href="{url}shortlog{sessionvars%urlparameter}">...</a></td> | |
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> | |
71 | </table> |
|
73 | </table> | |
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> | |
79 | </table> |
|
83 | </table> | |
80 |
|
84 | |||
81 | </%def> No newline at end of file |
|
85 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now