Show More
@@ -0,0 +1,40 b'' | |||||
|
1 | # Copyright (C) 2010-2023 RhodeCode GmbH | |||
|
2 | # | |||
|
3 | # This program is free software: you can redistribute it and/or modify | |||
|
4 | # it under the terms of the GNU Affero General Public License, version 3 | |||
|
5 | # (only), as published by the Free Software Foundation. | |||
|
6 | # | |||
|
7 | # This program is distributed in the hope that it will be useful, | |||
|
8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
10 | # GNU General Public License for more details. | |||
|
11 | # | |||
|
12 | # You should have received a copy of the GNU Affero General Public License | |||
|
13 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
|
14 | # | |||
|
15 | # This program is dual-licensed. If you wish to learn more about the | |||
|
16 | # RhodeCode Enterprise Edition, including its added features, Support services, | |||
|
17 | # and proprietary license terms, please see https://rhodecode.com/licenses/ | |||
|
18 | import os | |||
|
19 | ||||
|
20 | ||||
|
21 | def get_config(ini_path, **kwargs): | |||
|
22 | import configparser | |||
|
23 | parser = configparser.ConfigParser(**kwargs) | |||
|
24 | parser.read(ini_path) | |||
|
25 | return parser | |||
|
26 | ||||
|
27 | ||||
|
28 | def get_app_config_lightweight(ini_path): | |||
|
29 | parser = get_config(ini_path) | |||
|
30 | parser.set('app:main', 'here', os.getcwd()) | |||
|
31 | parser.set('app:main', '__file__', ini_path) | |||
|
32 | return dict(parser.items('app:main')) | |||
|
33 | ||||
|
34 | ||||
|
35 | def get_app_config(ini_path): | |||
|
36 | """ | |||
|
37 | This loads the app context and provides a heavy type iniliaziation of config | |||
|
38 | """ | |||
|
39 | from paste.deploy.loadwsgi import appconfig | |||
|
40 | return appconfig(f'config:{ini_path}', relative_to=os.getcwd()) |
@@ -765,8 +765,9 b' def svn_pre_commit(repo_path, commit_dat' | |||||
765 | else: |
|
765 | else: | |
766 | # fallback method to read from TXN-ID stored data |
|
766 | # fallback method to read from TXN-ID stored data | |
767 | extras = _get_extras_from_txn_id(path, txn_id) |
|
767 | extras = _get_extras_from_txn_id(path, txn_id) | |
|
768 | ||||
768 |
|
|
769 | if not extras: | |
769 | return 0 |
|
770 | raise ValueError('Failed to extract context data called extras for hook execution') | |
770 |
|
771 | |||
771 | extras['hook_type'] = 'pre_commit' |
|
772 | extras['hook_type'] = 'pre_commit' | |
772 | extras['commit_ids'] = [txn_id] |
|
773 | extras['commit_ids'] = [txn_id] | |
@@ -804,8 +805,9 b' def svn_post_commit(repo_path, commit_da' | |||||
804 | else: |
|
805 | else: | |
805 | # fallback method to read from TXN-ID stored data |
|
806 | # fallback method to read from TXN-ID stored data | |
806 | extras = _get_extras_from_commit_id(commit_id, path) |
|
807 | extras = _get_extras_from_commit_id(commit_id, path) | |
|
808 | ||||
807 |
|
|
809 | if not extras: | |
808 | return 0 |
|
810 | raise ValueError('Failed to extract context data called extras for hook execution') | |
809 |
|
811 | |||
810 | extras['hook_type'] = 'post_commit' |
|
812 | extras['hook_type'] = 'post_commit' | |
811 | extras['commit_ids'] = [commit_id] |
|
813 | extras['commit_ids'] = [commit_id] |
General Comments 0
You need to be logged in to leave comments.
Login now