Show More
@@ -22,8 +22,32 b' def make_map(config):' | |||
|
22 | 22 | map.connect('hg_home', '/', controller='hg', action='index') |
|
23 | 23 | |
|
24 | 24 | |
|
25 |
#REST |
|
|
26 | map.resource('repo', 'repos', path_prefix='/_admin') | |
|
25 | #REST routes | |
|
26 | with map.submapper(path_prefix='/_admin', controller='repos') as m: | |
|
27 | m.connect("repos", "/repos", | |
|
28 | action="create", conditions=dict(method=["POST"])) | |
|
29 | m.connect("repos", "/repos", | |
|
30 | action="index", conditions=dict(method=["GET"])) | |
|
31 | m.connect("formatted_repos", "/repos.{format}", | |
|
32 | action="index", | |
|
33 | conditions=dict(method=["GET"])) | |
|
34 | m.connect("new_repo", "/repos/new", | |
|
35 | action="new", conditions=dict(method=["GET"])) | |
|
36 | m.connect("formatted_new_repo", "/repos/new.{format}", | |
|
37 | action="new", conditions=dict(method=["GET"])) | |
|
38 | m.connect("/repos/{id:.*}", | |
|
39 | action="update", conditions=dict(method=["PUT"])) | |
|
40 | m.connect("/repos/{id:.*}", | |
|
41 | action="delete", conditions=dict(method=["DELETE"])) | |
|
42 | m.connect("edit_repo", "/repos/{id:.*}/edit", | |
|
43 | action="edit", conditions=dict(method=["GET"])) | |
|
44 | m.connect("formatted_edit_repo", "/repos/{id:.*}.{format}/edit", | |
|
45 | action="edit", conditions=dict(method=["GET"])) | |
|
46 | m.connect("repo", "/repos/{id:.*}", | |
|
47 | action="show", conditions=dict(method=["GET"])) | |
|
48 | m.connect("formatted_repo", "/repos/{id:.*}.{format}", | |
|
49 | action="show", conditions=dict(method=["GET"])) | |
|
50 | ||
|
27 | 51 | map.resource('user', 'users', path_prefix='/_admin') |
|
28 | 52 | map.resource('permission', 'permissions', path_prefix='/_admin') |
|
29 | 53 | |
@@ -34,34 +58,34 b' def make_map(config):' | |||
|
34 | 58 | action='add_repo') |
|
35 | 59 | |
|
36 | 60 | #FEEDS |
|
37 | map.connect('rss_feed_home', '/{repo_name}/feed/rss', | |
|
61 | map.connect('rss_feed_home', '/{repo_name:.*}/feed/rss', | |
|
38 | 62 | controller='feed', action='rss') |
|
39 | map.connect('atom_feed_home', '/{repo_name}/feed/atom', | |
|
63 | map.connect('atom_feed_home', '/{repo_name:.*}/feed/atom', | |
|
40 | 64 | controller='feed', action='atom') |
|
41 | 65 | |
|
42 | 66 | map.connect('login_home', '/login', controller='login') |
|
43 | 67 | map.connect('logout_home', '/logout', controller='login', action='logout') |
|
44 | 68 | |
|
45 | map.connect('changeset_home', '/{repo_name}/changeset/{revision}', | |
|
69 | map.connect('changeset_home', '/{repo_name:.*}/changeset/{revision}', | |
|
46 | 70 | controller='changeset', revision='tip') |
|
47 | map.connect('summary_home', '/{repo_name}/summary', | |
|
71 | map.connect('summary_home', '/{repo_name:.*}/summary', | |
|
48 | 72 | controller='summary') |
|
49 | map.connect('shortlog_home', '/{repo_name}/shortlog', | |
|
73 | map.connect('shortlog_home', '/{repo_name:.*}/shortlog', | |
|
50 | 74 | controller='shortlog') |
|
51 | map.connect('branches_home', '/{repo_name}/branches', | |
|
75 | map.connect('branches_home', '/{repo_name:.*}/branches', | |
|
52 | 76 | controller='branches') |
|
53 | map.connect('tags_home', '/{repo_name}/tags', | |
|
77 | map.connect('tags_home', '/{repo_name:.*}/tags', | |
|
54 | 78 | controller='tags') |
|
55 | map.connect('changelog_home', '/{repo_name}/changelog', | |
|
79 | map.connect('changelog_home', '/{repo_name:.*}/changelog', | |
|
56 | 80 | controller='changelog') |
|
57 | map.connect('files_home', '/{repo_name}/files/{revision}/{f_path:.*}', | |
|
81 | map.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}', | |
|
58 | 82 | controller='files', revision='tip', f_path='') |
|
59 | map.connect('files_diff_home', '/{repo_name}/diff/{f_path:.*}', | |
|
83 | map.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}', | |
|
60 | 84 | controller='files', action='diff', revision='tip', f_path='') |
|
61 | map.connect('files_raw_home', '/{repo_name}/rawfile/{revision}/{f_path:.*}', | |
|
85 | map.connect('files_raw_home', '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}', | |
|
62 | 86 | controller='files', action='rawfile', revision='tip', f_path='') |
|
63 | map.connect('files_annotate_home', '/{repo_name}/annotate/{revision}/{f_path:.*}', | |
|
87 | map.connect('files_annotate_home', '/{repo_name:.*}/annotate/{revision}/{f_path:.*}', | |
|
64 | 88 | controller='files', action='annotate', revision='tip', f_path='') |
|
65 | map.connect('files_archive_home', '/{repo_name}/archive/{revision}/{fileformat}', | |
|
89 | map.connect('files_archive_home', '/{repo_name:.*}/archive/{revision}/{fileformat}', | |
|
66 | 90 | controller='files', action='archivefile', revision='tip') |
|
67 | 91 | return map |
@@ -2,6 +2,8 b' from pylons import request, response, se' | |||
|
2 | 2 | app_globals as g |
|
3 | 3 | from pylons.controllers.util import abort, redirect |
|
4 | 4 | from pylons_app.lib.auth import LoginRequired |
|
5 | from pylons.i18n.translation import _ | |
|
6 | from pylons_app.lib import helpers as h | |
|
5 | 7 | from pylons_app.lib.base import BaseController, render |
|
6 | 8 | from pylons_app.lib.filters import clean_repo |
|
7 | 9 | from pylons_app.lib.utils import check_repo, invalidate_cache |
@@ -39,6 +41,7 b' class ReposController(BaseController):' | |||
|
39 | 41 | self._create_repo(name) |
|
40 | 42 | #clear our cached list for refresh with new repo |
|
41 | 43 | invalidate_cache('cached_repo_list') |
|
44 | h.flash(_('created repository %s') % name, category='success') | |
|
42 | 45 | except Exception as e: |
|
43 | 46 | log.error(e) |
|
44 | 47 | |
@@ -85,7 +88,7 b' class ReposController(BaseController):' | |||
|
85 | 88 | |
|
86 | 89 | #clear our cached list for refresh with new repo |
|
87 | 90 | invalidate_cache('cached_repo_list') |
|
88 | ||
|
91 | h.flash(_('deleted repository %s') % rm_path, category='success') | |
|
89 | 92 | return redirect(url('repos')) |
|
90 | 93 | |
|
91 | 94 |
@@ -50,8 +50,9 b' class SimpleHg(object):' | |||
|
50 | 50 | return result.wsgi_application(environ, start_response) |
|
51 | 51 | |
|
52 | 52 | try: |
|
53 | repo_name = environ['PATH_INFO'].split('/')[1] | |
|
54 | except: | |
|
53 | repo_name = '/'.join(environ['PATH_INFO'].split('/')[1:]) | |
|
54 | except Exception as e: | |
|
55 | log.error(e) | |
|
55 | 56 | return HTTPNotFound()(environ, start_response) |
|
56 | 57 | |
|
57 | 58 | #since we wrap into hgweb, just reset the path |
@@ -63,6 +64,7 b' class SimpleHg(object):' | |||
|
63 | 64 | try: |
|
64 | 65 | app = wsgiapplication(self.__make_app) |
|
65 | 66 | except Exception as e: |
|
67 | log.error(e) | |
|
66 | 68 | return HTTPNotFound()(environ, start_response) |
|
67 | 69 | action = self.__get_action(environ) |
|
68 | 70 | #invalidate cache on push |
@@ -6,10 +6,7 b' log = logging.getLogger(__name__)' | |||
|
6 | 6 | |
|
7 | 7 | |
|
8 | 8 | def get_repo_slug(request): |
|
9 | path_info = request.environ.get('PATH_INFO') | |
|
10 | uri_lst = path_info.split('/') | |
|
11 | repo_name = uri_lst[1] | |
|
12 | return repo_name | |
|
9 | return request.environ['pylons.routes_dict'].get('repo_name') | |
|
13 | 10 | |
|
14 | 11 | def is_mercurial(environ): |
|
15 | 12 | """ |
@@ -131,14 +128,7 b' class EmptyChangeset(BaseChangeset):' | |||
|
131 | 128 | |
|
132 | 129 | def repo2db_mapper(): |
|
133 | 130 | """ |
|
134 | put ! | |
|
131 | scann all dirs for .hgdbid | |
|
132 | if some dir doesn't have one generate one. | |
|
135 | 133 | """ |
|
136 |
pass |
|
|
137 | #scann all dirs for .hgdbid | |
|
138 | #if some dir doesn't have one generate one. | |
|
139 | # | |
|
140 | ||
|
141 | ||
|
142 | ||
|
143 | ||
|
144 | ||
|
134 | pass No newline at end of file |
@@ -82,7 +82,13 b' class HgModel(object):' | |||
|
82 | 82 | repos_list = {} |
|
83 | 83 | for name, path in repos: |
|
84 | 84 | try: |
|
85 | repos_list[name] = MercurialRepository(path, baseui=baseui) | |
|
85 | #name = name.split('/')[-1] | |
|
86 | if repos_list.has_key(name): | |
|
87 | raise RepositoryError('Duplicate repository name %s found in' | |
|
88 | ' %s' % (name, path)) | |
|
89 | else: | |
|
90 | repos_list[name] = MercurialRepository(path, baseui=baseui) | |
|
91 | repos_list[name].name = name | |
|
86 | 92 | except OSError: |
|
87 | 93 | continue |
|
88 | 94 | return repos_list |
General Comments 0
You need to be logged in to leave comments.
Login now