@@ -250,7 +250,7 @@ def ValidRepoName(edit, old_data):
gr = Group.get(value.get('repo_group'))
group_path = gr.full_path
# value needs to be aware of group name in order to check
# db key This is an actuall just the name to store in the
# db key This is an actual just the name to store in the
# database
repo_name_full = group_path + Group.url_sep() + repo_name
else:
@@ -259,25 +259,32 @@ def ValidRepoName(edit, old_data):
value['repo_name_full'] = repo_name_full
if old_data.get('repo_name') != repo_name_full or not edit:
rename = old_data.get('repo_name') != repo_name_full
create = not edit
if rename or create:
if group_path != '':
if RepoModel().get_by_repo_name(repo_name_full,):
e_dict = {'repo_name':_('This repository already '
'exists in group "%s"') %
'exists in a group "%s"') %
gr.group_name}
raise formencode.Invalid('', value, state,
error_dict=e_dict)
elif Group.get_by_group_name(repo_name_full):
e_dict = {'repo_name':_('There is a group with this'
' name already "%s"') %
repo_name_full}
if RepoModel().get_by_repo_name(repo_name_full):
elif RepoModel().get_by_repo_name(repo_name_full):
e_dict = {'repo_name':_('This repository '
'already exists')}
return value
return _ValidRepoName
def ValidForkName():
@@ -305,7 +305,7 @@ class RepoModel(BaseModel):
:param parent_id:
:param clone_uri:
"""
from rhodecode.lib.utils import is_valid_repo
from rhodecode.lib.utils import is_valid_repo,is_valid_repos_group
if new_parent_id:
paths = Group.get(new_parent_id).full_path.split(Group.url_sep())
@@ -316,7 +316,15 @@ class RepoModel(BaseModel):
repo_path = os.path.join(*map(lambda x:safe_str(x),
[self.repos_path, new_parent_path, repo_name]))
if is_valid_repo(repo_path, self.repos_path) is False:
# check if this path is not a repository
if is_valid_repo(repo_path, self.repos_path):
raise Exception('This path %s is a valid repository' % repo_path)
# check if this path is a group
if is_valid_repos_group(repo_path, self.repos_path):
raise Exception('This path %s is a valid group' % repo_path)
log.info('creating repo %s in %s @ %s', repo_name, repo_path,
clone_uri)
backend = get_backend(alias)
Status change: