Mercurial > public > src > rhodecode
comparison pylons_app/lib/celerylib/tasks.py @ 578:a08f610e545e
Implemented server side forks
added ability to pass session to user/repo models
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 01 Oct 2010 00:16:09 +0200 |
parents | b50e79b4257a |
children | 72778dda34cf |
comparison
equal
deleted
inserted
replaced
577:3a567e329fb6 | 578:a08f610e545e |
---|---|
269 log.error('Mail sending failed') | 269 log.error('Mail sending failed') |
270 log.error(traceback.format_exc()) | 270 log.error(traceback.format_exc()) |
271 return False | 271 return False |
272 return True | 272 return True |
273 | 273 |
274 @task | |
275 def create_repo_fork(form_data, cur_user): | |
276 import os | |
277 from pylons_app.lib.utils import invalidate_cache | |
278 from pylons_app.model.repo_model import RepoModel | |
279 sa = get_session() | |
280 rm = RepoModel(sa) | |
281 | |
282 rm.create(form_data, cur_user, just_db=True, fork=True) | |
283 | |
284 repos_path = get_hg_ui_settings()['paths_root_path'].replace('*', '') | |
285 repo_path = os.path.join(repos_path, form_data['repo_name']) | |
286 repo_fork_path = os.path.join(repos_path, form_data['fork_name']) | |
287 | |
288 MercurialRepository(str(repo_fork_path), True, clone_url=str(repo_path)) | |
289 #invalidate_cache('cached_repo_list') | |
290 | |
291 | |
274 def __get_codes_stats(repo_name): | 292 def __get_codes_stats(repo_name): |
275 LANGUAGES_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx', 'aspx', 'asx', 'axd', 'c', | 293 LANGUAGES_EXTENSIONS = ['action', 'adp', 'ashx', 'asmx', 'aspx', 'asx', 'axd', 'c', |
276 'cfg', 'cfm', 'cpp', 'cs', 'diff', 'do', 'el', 'erl', | 294 'cfg', 'cfm', 'cpp', 'cs', 'diff', 'do', 'el', 'erl', |
277 'h', 'java', 'js', 'jsp', 'jspx', 'lisp', | 295 'h', 'java', 'js', 'jsp', 'jspx', 'lisp', |
278 'lua', 'm', 'mako', 'ml', 'pas', 'patch', 'php', 'php3', | 296 'lua', 'm', 'mako', 'ml', 'pas', 'patch', 'php', 'php3', |