changeset 710:e2f3c8e6939d beta

Disable git support due to large problems with dulwich. Added one point of controll over supported backends in rhodecode.BACKENDS
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 18 Nov 2010 02:41:38 +0100
parents a23b686fb14d
children cda88b3eb09c
files rhodecode/__init__.py rhodecode/lib/base.py rhodecode/model/forms.py rhodecode/model/scm.py
diffstat 4 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/__init__.py	Thu Nov 18 02:25:12 2010 +0100
+++ b/rhodecode/__init__.py	Thu Nov 18 02:41:38 2010 +0100
@@ -33,3 +33,8 @@
     Returns shorter version (digit parts only) as string.
     """
     return '.'.join((str(each) for each in VERSION[:3]))
+
+BACKENDS = {
+    'hg': 'Mercurial repository',
+   #'git': 'Git repository',
+}
--- a/rhodecode/lib/base.py	Thu Nov 18 02:25:12 2010 +0100
+++ b/rhodecode/lib/base.py	Thu Nov 18 02:41:38 2010 +0100
@@ -10,7 +10,7 @@
 from rhodecode.lib.utils import get_repo_slug
 from rhodecode.model import meta
 from rhodecode.model.scm import ScmModel
-from vcs import BACKENDS
+from rhodecode import BACKENDS
 
 class BaseController(WSGIController):
 
--- a/rhodecode/model/forms.py	Thu Nov 18 02:25:12 2010 +0100
+++ b/rhodecode/model/forms.py	Thu Nov 18 02:41:38 2010 +0100
@@ -31,7 +31,7 @@
 from rhodecode.model.repo import RepoModel
 from rhodecode.model.db import User
 from webhelpers.pylonslib.secure_form import authentication_token
-from vcs import BACKENDS
+from rhodecode import BACKENDS
 import formencode
 import logging
 import os
@@ -301,28 +301,28 @@
         email = All(ValidSystemEmail(), Email(not_empty=True))
     return _PasswordResetForm
 
-def RepoForm(edit=False, old_data={}):
+def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys()):
     class _RepoForm(formencode.Schema):
         allow_extra_fields = True
         filter_extra_fields = False
         repo_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data))
         description = UnicodeString(strip=True, min=1, not_empty=True)
         private = StringBoolean(if_missing=False)
-        repo_type = OneOf(BACKENDS.keys())
+        repo_type = OneOf(supported_backends)
         if edit:
             user = All(Int(not_empty=True), ValidRepoUser)
 
         chained_validators = [ValidPerms]
     return _RepoForm
 
-def RepoForkForm(edit=False, old_data={}):
+def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys()):
     class _RepoForkForm(formencode.Schema):
         allow_extra_fields = True
         filter_extra_fields = False
         fork_name = All(UnicodeString(strip=True, min=1, not_empty=True), ValidRepoName(edit, old_data))
         description = UnicodeString(strip=True, min=1, not_empty=True)
         private = StringBoolean(if_missing=False)
-        repo_type = All(ValidForkType(old_data), OneOf(BACKENDS.keys()))
+        repo_type = All(ValidForkType(old_data), OneOf(supported_backends))
     return _RepoForkForm
 
 def RepoSettingsForm(edit=False, old_data={}):
--- a/rhodecode/model/scm.py	Thu Nov 18 02:25:12 2010 +0100
+++ b/rhodecode/model/scm.py	Thu Nov 18 02:41:38 2010 +0100
@@ -24,6 +24,7 @@
 """
 from beaker.cache import cache_region, region_invalidate
 from mercurial import ui
+from rhodecode import BACKENDS
 from rhodecode.lib import helpers as h
 from rhodecode.lib.auth import HasRepoPermissionAny
 from rhodecode.lib.utils import get_repos
@@ -84,10 +85,10 @@
 
                     klass = get_backend(path[0])
 
-                    if path[0] == 'hg':
+                    if path[0] == 'hg' and path[0] in BACKENDS.keys():
                         repos_list[name] = klass(path[1], baseui=baseui)
 
-                    if path[0] == 'git':
+                    if path[0] == 'git' and path[0] in BACKENDS.keys():
                         repos_list[name] = klass(path[1])
             except OSError:
                 continue
@@ -152,6 +153,7 @@
             log.debug('Creating instance of %s repository', alias)
             backend = get_backend(alias)
 
+            #TODO: get the baseui from somewhere for this
             if alias == 'hg':
                 repo = backend(repo_path, create=False, baseui=None)
                 #skip hidden web repository