comparison rhodecode/lib/celerylib/tasks.py @ 659:758f64f3fbda beta

extended repo creation by repo type. fixed fork creation to maintain repo type.
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 05 Nov 2010 21:55:30 +0100
parents fd63782c4426
children 373ee7031003
comparison
equal deleted inserted replaced
658:4ecb2ffcc110 659:758f64f3fbda
287 return False 287 return False
288 return True 288 return True
289 289
290 @task 290 @task
291 def create_repo_fork(form_data, cur_user): 291 def create_repo_fork(form_data, cur_user):
292 import os
293 from rhodecode.model.repo import RepoModel 292 from rhodecode.model.repo import RepoModel
294 293 from vcs import get_backend
294 log = create_repo_fork.get_logger()
295 repo_model = RepoModel(get_session()) 295 repo_model = RepoModel(get_session())
296 repo_model.create(form_data, cur_user, just_db=True, fork=True) 296 repo_model.create(form_data, cur_user, just_db=True, fork=True)
297 297 repo_name = form_data['repo_name']
298 repos_path = get_hg_ui_settings()['paths_root_path'].replace('*', '') 298 repos_path = get_hg_ui_settings()['paths_root_path']
299 repo_path = os.path.join(repos_path, form_data['repo_name']) 299 repo_path = os.path.join(repos_path, repo_name)
300 repo_fork_path = os.path.join(repos_path, form_data['fork_name']) 300 repo_fork_path = os.path.join(repos_path, form_data['fork_name'])
301 301 alias = form_data['repo_type']
302 MercurialRepository(str(repo_fork_path), True, clone_url=str(repo_path)) 302
303 303 log.info('creating repo fork %s as %s', repo_name, repo_path)
304 backend = get_backend(alias)
305 backend(str(repo_fork_path), create=True, src_url=str(repo_path))
304 306
305 def __get_codes_stats(repo_name): 307 def __get_codes_stats(repo_name):
306 LANGUAGES_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx', 308 LANGUAGES_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx',
307 'aspx', 'asx', 'axd', 'c', 'cfg', 'cfm', 'cpp', 'cs', 'diff', 'do', 'el', 309 'aspx', 'asx', 'axd', 'c', 'cfg', 'cfm', 'cpp', 'cs', 'diff', 'do', 'el',
308 'erl', 'h', 'java', 'js', 'jsp', 'jspx', 'lisp', 'lua', 'm', 'mako', 'ml', 310 'erl', 'h', 'java', 'js', 'jsp', 'jspx', 'lisp', 'lua', 'm', 'mako', 'ml',