Show More
@@ -33,3 +33,8 b' def get_version():' | |||||
33 | Returns shorter version (digit parts only) as string. |
|
33 | Returns shorter version (digit parts only) as string. | |
34 | """ |
|
34 | """ | |
35 | return '.'.join((str(each) for each in VERSION[:3])) |
|
35 | return '.'.join((str(each) for each in VERSION[:3])) | |
|
36 | ||||
|
37 | BACKENDS = { | |||
|
38 | 'hg': 'Mercurial repository', | |||
|
39 | #'git': 'Git repository', | |||
|
40 | } |
@@ -10,7 +10,7 b' from rhodecode.lib import auth' | |||||
10 | from rhodecode.lib.utils import get_repo_slug |
|
10 | from rhodecode.lib.utils import get_repo_slug | |
11 | from rhodecode.model import meta |
|
11 | from rhodecode.model import meta | |
12 | from rhodecode.model.scm import ScmModel |
|
12 | from rhodecode.model.scm import ScmModel | |
13 |
from |
|
13 | from rhodecode import BACKENDS | |
14 |
|
14 | |||
15 | class BaseController(WSGIController): |
|
15 | class BaseController(WSGIController): | |
16 |
|
16 |
@@ -31,7 +31,7 b' from rhodecode.model.user import UserMod' | |||||
31 | from rhodecode.model.repo import RepoModel |
|
31 | from rhodecode.model.repo import RepoModel | |
32 | from rhodecode.model.db import User |
|
32 | from rhodecode.model.db import User | |
33 | from webhelpers.pylonslib.secure_form import authentication_token |
|
33 | from webhelpers.pylonslib.secure_form import authentication_token | |
34 |
from |
|
34 | from rhodecode import BACKENDS | |
35 | import formencode |
|
35 | import formencode | |
36 | import logging |
|
36 | import logging | |
37 | import os |
|
37 | import os | |
@@ -301,28 +301,28 b' def PasswordResetForm():' | |||||
301 | email = All(ValidSystemEmail(), Email(not_empty=True)) |
|
301 | email = All(ValidSystemEmail(), Email(not_empty=True)) | |
302 | return _PasswordResetForm |
|
302 | return _PasswordResetForm | |
303 |
|
303 | |||
304 | def RepoForm(edit=False, old_data={}): |
|
304 | def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys()): | |
305 | class _RepoForm(formencode.Schema): |
|
305 | class _RepoForm(formencode.Schema): | |
306 | allow_extra_fields = True |
|
306 | allow_extra_fields = True | |
307 | filter_extra_fields = False |
|
307 | filter_extra_fields = False | |
308 | repo_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data)) |
|
308 | repo_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data)) | |
309 | description = UnicodeString(strip=True, min=1, not_empty=True) |
|
309 | description = UnicodeString(strip=True, min=1, not_empty=True) | |
310 | private = StringBoolean(if_missing=False) |
|
310 | private = StringBoolean(if_missing=False) | |
311 |
repo_type = OneOf( |
|
311 | repo_type = OneOf(supported_backends) | |
312 | if edit: |
|
312 | if edit: | |
313 | user = All(Int(not_empty=True), ValidRepoUser) |
|
313 | user = All(Int(not_empty=True), ValidRepoUser) | |
314 |
|
314 | |||
315 | chained_validators = [ValidPerms] |
|
315 | chained_validators = [ValidPerms] | |
316 | return _RepoForm |
|
316 | return _RepoForm | |
317 |
|
317 | |||
318 | def RepoForkForm(edit=False, old_data={}): |
|
318 | def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys()): | |
319 | class _RepoForkForm(formencode.Schema): |
|
319 | class _RepoForkForm(formencode.Schema): | |
320 | allow_extra_fields = True |
|
320 | allow_extra_fields = True | |
321 | filter_extra_fields = False |
|
321 | filter_extra_fields = False | |
322 | fork_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data)) |
|
322 | fork_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data)) | |
323 | description = UnicodeString(strip=True, min=1, not_empty=True) |
|
323 | description = UnicodeString(strip=True, min=1, not_empty=True) | |
324 | private = StringBoolean(if_missing=False) |
|
324 | private = StringBoolean(if_missing=False) | |
325 |
repo_type = All(ValidForkType(old_data), OneOf( |
|
325 | repo_type = All(ValidForkType(old_data), OneOf(supported_backends)) | |
326 | return _RepoForkForm |
|
326 | return _RepoForkForm | |
327 |
|
327 | |||
328 | def RepoSettingsForm(edit=False, old_data={}): |
|
328 | def RepoSettingsForm(edit=False, old_data={}): |
@@ -24,6 +24,7 b' Model for RhodeCode' | |||||
24 | """ |
|
24 | """ | |
25 | from beaker.cache import cache_region, region_invalidate |
|
25 | from beaker.cache import cache_region, region_invalidate | |
26 | from mercurial import ui |
|
26 | from mercurial import ui | |
|
27 | from rhodecode import BACKENDS | |||
27 | from rhodecode.lib import helpers as h |
|
28 | from rhodecode.lib import helpers as h | |
28 | from rhodecode.lib.auth import HasRepoPermissionAny |
|
29 | from rhodecode.lib.auth import HasRepoPermissionAny | |
29 | from rhodecode.lib.utils import get_repos |
|
30 | from rhodecode.lib.utils import get_repos | |
@@ -84,10 +85,10 b' class ScmModel(object):' | |||||
84 |
|
85 | |||
85 | klass = get_backend(path[0]) |
|
86 | klass = get_backend(path[0]) | |
86 |
|
87 | |||
87 | if path[0] == 'hg': |
|
88 | if path[0] == 'hg' and path[0] in BACKENDS.keys(): | |
88 | repos_list[name] = klass(path[1], baseui=baseui) |
|
89 | repos_list[name] = klass(path[1], baseui=baseui) | |
89 |
|
90 | |||
90 | if path[0] == 'git': |
|
91 | if path[0] == 'git' and path[0] in BACKENDS.keys(): | |
91 | repos_list[name] = klass(path[1]) |
|
92 | repos_list[name] = klass(path[1]) | |
92 | except OSError: |
|
93 | except OSError: | |
93 | continue |
|
94 | continue | |
@@ -152,6 +153,7 b' class ScmModel(object):' | |||||
152 | log.debug('Creating instance of %s repository', alias) |
|
153 | log.debug('Creating instance of %s repository', alias) | |
153 | backend = get_backend(alias) |
|
154 | backend = get_backend(alias) | |
154 |
|
155 | |||
|
156 | #TODO: get the baseui from somewhere for this | |||
155 | if alias == 'hg': |
|
157 | if alias == 'hg': | |
156 | repo = backend(repo_path, create=False, baseui=None) |
|
158 | repo = backend(repo_path, create=False, baseui=None) | |
157 | #skip hidden web repository |
|
159 | #skip hidden web repository |
General Comments 0
You need to be logged in to leave comments.
Login now