Show More
@@ -492,6 +492,7 b' class ReposController(BaseRepoController' | |||||
492 | ScmModel().pull_changes(repo_name, self.rhodecode_user.username) |
|
492 | ScmModel().pull_changes(repo_name, self.rhodecode_user.username) | |
493 | h.flash(_('Pulled from remote location'), category='success') |
|
493 | h.flash(_('Pulled from remote location'), category='success') | |
494 | except Exception, e: |
|
494 | except Exception, e: | |
|
495 | log.error(traceback.format_exc()) | |||
495 | h.flash(_('An error occurred during pull from remote location'), |
|
496 | h.flash(_('An error occurred during pull from remote location'), | |
496 | category='error') |
|
497 | category='error') | |
497 |
|
498 |
@@ -424,6 +424,30 b' class ScmModel(BaseModel):' | |||||
424 | self.sa.add(repo) |
|
424 | self.sa.add(repo) | |
425 | return repo |
|
425 | return repo | |
426 |
|
426 | |||
|
427 | def _handle_rc_scm_extras(self, username, repo_name, repo_alias): | |||
|
428 | from rhodecode import CONFIG | |||
|
429 | from rhodecode.lib.base import _get_ip_addr | |||
|
430 | try: | |||
|
431 | from pylons import request | |||
|
432 | environ = request.environ | |||
|
433 | except TypeError: | |||
|
434 | # we might use this outside of request context, let's fake the | |||
|
435 | # environ data | |||
|
436 | from webob import Request | |||
|
437 | environ = Request.blank('').environ | |||
|
438 | extras = { | |||
|
439 | 'ip': _get_ip_addr(environ), | |||
|
440 | 'username': username, | |||
|
441 | 'action': 'push_local', | |||
|
442 | 'repository': repo_name, | |||
|
443 | 'scm': repo_alias, | |||
|
444 | 'config': CONFIG['__file__'], | |||
|
445 | 'server_url': get_server_url(environ), | |||
|
446 | 'make_lock': None, | |||
|
447 | 'locked_by': [None, None] | |||
|
448 | } | |||
|
449 | _set_extras(extras) | |||
|
450 | ||||
427 | def _handle_push(self, repo, username, action, repo_name, revisions): |
|
451 | def _handle_push(self, repo, username, action, repo_name, revisions): | |
428 | """ |
|
452 | """ | |
429 | Triggers push action hooks |
|
453 | Triggers push action hooks | |
@@ -434,31 +458,9 b' class ScmModel(BaseModel):' | |||||
434 | :param repo_name: name of repo |
|
458 | :param repo_name: name of repo | |
435 | :param revisions: list of revisions that we pushed |
|
459 | :param revisions: list of revisions that we pushed | |
436 | """ |
|
460 | """ | |
437 | from rhodecode import CONFIG |
|
461 | self._handle_rc_scm_extras(username, repo_name, repo_alias=repo.alias) | |
438 | from rhodecode.lib.base import _get_ip_addr |
|
|||
439 | try: |
|
|||
440 | from pylons import request |
|
|||
441 | environ = request.environ |
|
|||
442 | except TypeError: |
|
|||
443 | # we might use this outside of request context, let's fake the |
|
|||
444 | # environ data |
|
|||
445 | from webob import Request |
|
|||
446 | environ = Request.blank('').environ |
|
|||
447 |
|
||||
448 | #trigger push hook |
|
|||
449 | extras = { |
|
|||
450 | 'ip': _get_ip_addr(environ), |
|
|||
451 | 'username': username, |
|
|||
452 | 'action': 'push_local', |
|
|||
453 | 'repository': repo_name, |
|
|||
454 | 'scm': repo.alias, |
|
|||
455 | 'config': CONFIG['__file__'], |
|
|||
456 | 'server_url': get_server_url(environ), |
|
|||
457 | 'make_lock': None, |
|
|||
458 | 'locked_by': [None, None] |
|
|||
459 | } |
|
|||
460 | _scm_repo = repo._repo |
|
462 | _scm_repo = repo._repo | |
461 | _set_extras(extras) |
|
463 | # trigger push hook | |
462 | if repo.alias == 'hg': |
|
464 | if repo.alias == 'hg': | |
463 | log_push_action(_scm_repo.ui, _scm_repo, node=revisions[0]) |
|
465 | log_push_action(_scm_repo.ui, _scm_repo, node=revisions[0]) | |
464 | elif repo.alias == 'git': |
|
466 | elif repo.alias == 'git': |
General Comments 0
You need to be logged in to leave comments.
Login now