##// END OF EJS Templates
fixed repo_create hooks for forks
marcink -
r2185:eac0d619 beta
parent child Browse files
Show More
@@ -47,6 +47,7 b' from rhodecode.lib.helpers import person'
47 from rhodecode.lib.rcmail.smtp_mailer import SmtpMailer
47 from rhodecode.lib.rcmail.smtp_mailer import SmtpMailer
48 from rhodecode.lib.utils import add_cache, action_logger
48 from rhodecode.lib.utils import add_cache, action_logger
49 from rhodecode.lib.compat import json, OrderedDict
49 from rhodecode.lib.compat import json, OrderedDict
50 from rhodecode.lib.hooks import log_create_repository
50
51
51 from rhodecode.model.db import Statistics, Repository, User
52 from rhodecode.model.db import Statistics, Repository, User
52
53
@@ -372,7 +373,8 b' def create_repo_fork(form_data, cur_user'
372
373
373 base_path = Repository.base_path()
374 base_path = Repository.base_path()
374
375
375 RepoModel(DBS).create(form_data, cur_user, just_db=True, fork=True)
376 fork_repo = RepoModel(DBS).create(form_data, cur_user,
377 just_db=True, fork=True)
376
378
377 alias = form_data['repo_type']
379 alias = form_data['repo_type']
378 org_repo_name = form_data['org_path']
380 org_repo_name = form_data['org_path']
@@ -387,6 +389,8 b' def create_repo_fork(form_data, cur_user'
387 backend(safe_str(destination_fork_path), create=True,
389 backend(safe_str(destination_fork_path), create=True,
388 src_url=safe_str(source_repo_path),
390 src_url=safe_str(source_repo_path),
389 update_after_clone=update_after_clone)
391 update_after_clone=update_after_clone)
392 log_create_repository(fork_repo.get_dict(), created_by=cur_user.username)
393
390 action_logger(cur_user, 'user_forked_repo:%s' % fork_name,
394 action_logger(cur_user, 'user_forked_repo:%s' % fork_name,
391 org_repo_name, '', DBS)
395 org_repo_name, '', DBS)
392
396
@@ -395,6 +399,7 b' def create_repo_fork(form_data, cur_user'
395 # finally commit at latest possible stage
399 # finally commit at latest possible stage
396 DBS.commit()
400 DBS.commit()
397
401
402
398 def __get_codes_stats(repo_name):
403 def __get_codes_stats(repo_name):
399 from rhodecode.config.conf import LANGUAGES_EXTENSIONS_MAP
404 from rhodecode.config.conf import LANGUAGES_EXTENSIONS_MAP
400 repo = Repository.get_by_repo_name(repo_name).scm_instance
405 repo = Repository.get_by_repo_name(repo_name).scm_instance
@@ -286,12 +286,12 b' class RepoModel(BaseModel):'
286 self.__create_repo(repo_name, form_data['repo_type'],
286 self.__create_repo(repo_name, form_data['repo_type'],
287 form_data['repo_group'],
287 form_data['repo_group'],
288 form_data['clone_uri'])
288 form_data['clone_uri'])
289 log_create_repository(new_repo.get_dict(),
290 created_by=cur_user.username)
289
291
290 # now automatically start following this repository as owner
292 # now automatically start following this repository as owner
291 ScmModel(self.sa).toggle_following_repo(new_repo.repo_id,
293 ScmModel(self.sa).toggle_following_repo(new_repo.repo_id,
292 cur_user.user_id)
294 cur_user.user_id)
293 log_create_repository(new_repo.get_dict(),
294 created_by=cur_user.username)
295 return new_repo
295 return new_repo
296 except:
296 except:
297 log.error(traceback.format_exc())
297 log.error(traceback.format_exc())
General Comments 0
You need to be logged in to leave comments. Login now