Mercurial > kallithea
changeset 7358:89c30b145bb8
middleware: inline the _set_extras invocation from the __inject_extras method, leaving behind only functionality for augmenting ui from hgrc
I don't know about the logic for merging hg configs ... but for now it is left untouched.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Wed, 08 Aug 2018 02:23:11 +0200 |
parents | 939dfe77df58 |
children | 0ebcc88f1280 |
files | kallithea/lib/middleware/simplegit.py kallithea/lib/middleware/simplehg.py |
diffstat | 2 files changed, 8 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/middleware/simplegit.py Wed Aug 08 02:23:11 2018 +0200 +++ b/kallithea/lib/middleware/simplegit.py Wed Aug 08 02:23:11 2018 +0200 @@ -132,7 +132,7 @@ fix_PATH() log.debug('HOOKS extras is %s', extras) baseui = make_ui('db') - self.__inject_extras(repo_path, baseui, extras) + _set_extras(extras or {}) try: self._handle_githooks(repo_name, action, baseui, environ) @@ -225,12 +225,3 @@ pull_lock_handling(ui=baseui, repo=_repo._repo) if action == 'pull' and _hooks.get(Ui.HOOK_PULL_LOG): log_pull_action(ui=baseui, repo=_repo._repo) - - def __inject_extras(self, repo_path, baseui, extras=None): - """ - Injects some extra params into baseui instance - - :param baseui: baseui instance - :param extras: dict with extra params to put into baseui - """ - _set_extras(extras or {})
--- a/kallithea/lib/middleware/simplehg.py Wed Aug 08 02:23:11 2018 +0200 +++ b/kallithea/lib/middleware/simplehg.py Wed Aug 08 02:23:11 2018 +0200 @@ -142,7 +142,8 @@ fix_PATH() log.debug('HOOKS extras is %s', extras) baseui = make_ui('db') - self.__inject_extras(repo_path, baseui, extras) + self._augment_hgrc(repo_path, baseui) + _set_extras(extras or {}) try: log.info('%s action on Mercurial repo "%s" by "%s" from %s', @@ -223,23 +224,10 @@ # Note: the client doesn't get the helpful error message raise HTTPBadRequest('Unable to detect pull/push action! Are you using non standard command or client?') - def __inject_extras(self, repo_path, baseui, extras=None): - """ - 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 - """ - + def _augment_hgrc(self, repo_path, baseui): + """Augment baseui with config settings from the repo_path repo""" hgrc = os.path.join(repo_path, '.hg', 'hgrc') - repoui = make_ui('file', hgrc) - - 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 or {}) + for section in ui_sections: + for k, v in repoui.configitems(section): + baseui.setconfig(section, k, v)