def __inject_extras(self, repo_path, baseui, extras={}): """ Injects some extra params into baseui instance :param baseui: baseui instance :param extras: dict with extra params to put into baseui """ _set_extras(extras)
def _handle_push(self, repo, username, action, repo_name, revisions): """ Triggers push action hooks :param repo: SCM repo :param username: username who pushes :param action: push/push_loca/push_remote :param repo_name: name of repo :param revisions: list of revisions that we pushed """ from rhodecode import CONFIG from rhodecode.lib.base import _get_ip_addr try: from pylons import request environ = request.environ except TypeError: # we might use this outside of request context, let's fake the # environ data from webob import Request environ = Request.blank('').environ #trigger push hook extras = { 'ip': _get_ip_addr(environ), 'username': username, 'action': 'push_local', 'repository': repo_name, 'scm': repo.alias, 'config': CONFIG['__file__'], 'server_url': get_server_url(environ), 'make_lock': None, 'locked_by': [None, None] } _scm_repo = repo._repo _set_extras(extras) if repo.alias == 'hg': log_push_action(_scm_repo.ui, _scm_repo, node=revisions[0]) elif repo.alias == 'git': log_push_action(None, _scm_repo, _git_revs=revisions)
def __inject_extras(self, repo_path, baseui, extras={}): """ Injects some extra params into baseui instance also overwrites global settings with those takes from local hgrc file :param baseui: baseui instance :param extras: dict with extra params to put into baseui """ hgrc = os.path.join(repo_path, '.hg', 'hgrc') # make our hgweb quiet so it doesn't print output baseui.setconfig('ui', 'quiet', 'true') repoui = make_ui('file', hgrc, False) if repoui: #overwrite our ui instance with the section from hgrc file for section in ui_sections: for k, v in repoui.configitems(section): baseui.setconfig(section, k, v) _set_extras(extras)
def __inject_extras(self, repo_path, baseui, extras={}): """ Injects some extra params into baseui instance also overwrites global settings with those takes from local hgrc file :param baseui: baseui instance :param extras: dict with extra params to put into baseui """ hgrc = os.path.join(repo_path, ".hg", "hgrc") # make our hgweb quiet so it doesn't print output baseui.setconfig("ui", "quiet", "true") repoui = make_ui("file", hgrc, False) if repoui: # overwrite our ui instance with the section from hgrc file for section in ui_sections: for k, v in repoui.configitems(section): baseui.setconfig(section, k, v) _set_extras(extras)
def _handle_rc_scm_extras(self, username, repo_name, repo_alias, action=None): from rhodecode import CONFIG from rhodecode.lib.base import _get_ip_addr try: from pylons import request environ = request.environ except TypeError: # we might use this outside of request context, let's fake the # environ data from webob import Request environ = Request.blank('').environ extras = { 'ip': _get_ip_addr(environ), 'username': username, 'action': action or 'push_local', 'repository': repo_name, 'scm': repo_alias, 'config': CONFIG['__file__'], 'server_url': get_server_url(environ), 'make_lock': None, 'locked_by': [None, None] } _set_extras(extras)