Show More
@@ -615,6 +615,12 b' vcs.connection_timeout = 3600' | |||||
615 | ; Legacy available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible |
|
615 | ; Legacy available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible | |
616 | #vcs.svn.compatible_version = 1.8 |
|
616 | #vcs.svn.compatible_version = 1.8 | |
617 |
|
617 | |||
|
618 | ; Enable SVN proxy of requests over HTTP | |||
|
619 | vcs.svn.proxy.enabled = true | |||
|
620 | ||||
|
621 | ; host to connect to running SVN subsystem | |||
|
622 | vcs.svn.proxy.host = http://svn:8090 | |||
|
623 | ||||
618 | ; Cache flag to cache vcsserver remote calls locally |
|
624 | ; Cache flag to cache vcsserver remote calls locally | |
619 | ; It uses cache_region `cache_repo` |
|
625 | ; It uses cache_region `cache_repo` | |
620 | vcs.methods.cache = true |
|
626 | vcs.methods.cache = true |
@@ -566,6 +566,12 b' vcs.connection_timeout = 3600' | |||||
566 | ; Legacy available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible |
|
566 | ; Legacy available options are: pre-1.4-compatible, pre-1.5-compatible, pre-1.6-compatible, pre-1.8-compatible, pre-1.9-compatible | |
567 | #vcs.svn.compatible_version = 1.8 |
|
567 | #vcs.svn.compatible_version = 1.8 | |
568 |
|
568 | |||
|
569 | ; Enable SVN proxy of requests over HTTP | |||
|
570 | vcs.svn.proxy.enabled = true | |||
|
571 | ||||
|
572 | ; host to connect to running SVN subsystem | |||
|
573 | vcs.svn.proxy.host = http://svn:8090 | |||
|
574 | ||||
569 | ; Cache flag to cache vcsserver remote calls locally |
|
575 | ; Cache flag to cache vcsserver remote calls locally | |
570 | ; It uses cache_region `cache_repo` |
|
576 | ; It uses cache_region `cache_repo` | |
571 | vcs.methods.cache = true |
|
577 | vcs.methods.cache = true |
@@ -1,4 +1,3 b'' | |||||
1 |
|
||||
2 |
|
|
1 | # Copyright (C) 2010-2023 RhodeCode GmbH | |
3 | # |
|
2 | # | |
4 | # This program is free software: you can redistribute it and/or modify |
|
3 | # This program is free software: you can redistribute it and/or modify | |
@@ -52,11 +51,11 b' def assert_clone_url(response, server, r' | |||||
52 |
|
51 | |||
53 | @pytest.mark.usefixtures('app') |
|
52 | @pytest.mark.usefixtures('app') | |
54 | class TestSummaryView(object): |
|
53 | class TestSummaryView(object): | |
|
54 | ||||
55 | def test_index(self, autologin_user, backend, http_host_only_stub): |
|
55 | def test_index(self, autologin_user, backend, http_host_only_stub): | |
56 | repo_id = backend.repo.repo_id |
|
56 | repo_id = backend.repo.repo_id | |
57 | repo_name = backend.repo_name |
|
57 | repo_name = backend.repo_name | |
58 | with mock.patch('rhodecode.lib.helpers.is_svn_without_proxy', |
|
58 | ||
59 | return_value=False): |
|
|||
60 |
|
|
59 | response = self.app.get( | |
61 |
|
|
60 | route_path('repo_summary', repo_name=repo_name)) | |
62 |
|
61 | |||
@@ -71,37 +70,43 b' class TestSummaryView(object):' | |||||
71 |
|
70 | |||
72 | # clone url... |
|
71 | # clone url... | |
73 | assert_clone_url(response, http_host_only_stub, repo_name) |
|
72 | assert_clone_url(response, http_host_only_stub, repo_name) | |
74 |
assert_clone_url(response, http_host_only_stub, '_{}' |
|
73 | assert_clone_url(response, http_host_only_stub, f'_{repo_id}') | |
75 |
|
74 | |||
76 | def test_index_svn_without_proxy( |
|
75 | def test_index_svn_without_proxy( | |
77 | self, autologin_user, backend_svn, http_host_only_stub): |
|
76 | self, autologin_user, backend_svn, http_host_only_stub): | |
|
77 | ||||
78 | repo_id = backend_svn.repo.repo_id |
|
78 | repo_id = backend_svn.repo.repo_id | |
79 | repo_name = backend_svn.repo_name |
|
79 | repo_name = backend_svn.repo_name | |
80 | response = self.app.get(route_path('repo_summary', repo_name=repo_name)) |
|
80 | ||
81 | # clone url... |
|
81 | # by default the SVN is enabled now, this is how inputs look when it's disabled | |
|
82 | with mock.patch('rhodecode.lib.helpers.is_svn_without_proxy', return_value=True): | |||
82 |
|
83 | |||
|
84 | response = self.app.get( | |||
|
85 | route_path('repo_summary', repo_name=repo_name), | |||
|
86 | status=200) | |||
|
87 | ||||
|
88 | # clone url test... | |||
83 | assert_clone_url(response, http_host_only_stub, repo_name, disabled=True) |
|
89 | assert_clone_url(response, http_host_only_stub, repo_name, disabled=True) | |
84 |
assert_clone_url(response, http_host_only_stub, '_{}' |
|
90 | assert_clone_url(response, http_host_only_stub, f'_{repo_id}', disabled=True) | |
85 |
|
91 | |||
86 | def test_index_with_trailing_slash( |
|
92 | def test_index_with_trailing_slash( | |
87 | self, autologin_user, backend, http_host_only_stub): |
|
93 | self, autologin_user, backend, http_host_only_stub): | |
88 |
|
94 | |||
89 | repo_id = backend.repo.repo_id |
|
95 | repo_id = backend.repo.repo_id | |
90 | repo_name = backend.repo_name |
|
96 | repo_name = backend.repo_name | |
91 | with mock.patch('rhodecode.lib.helpers.is_svn_without_proxy', |
|
97 | trailing_slash = '/' | |
92 | return_value=False): |
|
|||
93 |
|
|
98 | response = self.app.get( | |
94 |
|
|
99 | route_path('repo_summary', repo_name=repo_name) + trailing_slash, | |
95 |
|
|
100 | status=200) | |
96 |
|
101 | |||
97 | # clone url... |
|
102 | # clone url... | |
98 | assert_clone_url(response, http_host_only_stub, repo_name) |
|
103 | assert_clone_url(response, http_host_only_stub, repo_name) | |
99 |
assert_clone_url(response, http_host_only_stub, '_{}' |
|
104 | assert_clone_url(response, http_host_only_stub, f'_{repo_id}') | |
100 |
|
105 | |||
101 | def test_index_by_id(self, autologin_user, backend): |
|
106 | def test_index_by_id(self, autologin_user, backend): | |
102 | repo_id = backend.repo.repo_id |
|
107 | repo_id = backend.repo.repo_id | |
103 | response = self.app.get( |
|
108 | response = self.app.get( | |
104 |
route_path('repo_summary', repo_name='_ |
|
109 | route_path('repo_summary', repo_name=f'_{repo_id}')) | |
105 |
|
110 | |||
106 | # repo type |
|
111 | # repo type | |
107 | response.mustcontain( |
|
112 | response.mustcontain( |
@@ -244,7 +244,8 b' class SubversionServer(VcsServer):' | |||||
244 | # if exit_code: |
|
244 | # if exit_code: | |
245 | # return exit_code, False |
|
245 | # return exit_code, False | |
246 |
|
246 | |||
247 |
req = self.env |
|
247 | req = self.env.get('request') | |
|
248 | if req: | |||
248 | server_url = req.host_url + req.script_name |
|
249 | server_url = req.host_url + req.script_name | |
249 | extras['server_url'] = server_url |
|
250 | extras['server_url'] = server_url | |
250 |
|
251 |
@@ -542,6 +542,8 b' def sanitize_settings_and_apply_defaults' | |||||
542 | settings_maker.make_setting('statsd.statsd_ipv6', False, parser='bool') |
|
542 | settings_maker.make_setting('statsd.statsd_ipv6', False, parser='bool') | |
543 |
|
543 | |||
544 | settings_maker.make_setting('vcs.svn.compatible_version', '') |
|
544 | settings_maker.make_setting('vcs.svn.compatible_version', '') | |
|
545 | settings_maker.make_setting('vcs.svn.proxy.enabled', 'true', parser='bool') | |||
|
546 | settings_maker.make_setting('vcs.svn.proxy.host', 'http://svn:8090') | |||
545 | settings_maker.make_setting('vcs.hooks.protocol', 'http') |
|
547 | settings_maker.make_setting('vcs.hooks.protocol', 'http') | |
546 | settings_maker.make_setting('vcs.hooks.host', '*') |
|
548 | settings_maker.make_setting('vcs.hooks.host', '*') | |
547 | settings_maker.make_setting('vcs.scm_app_implementation', 'http') |
|
549 | settings_maker.make_setting('vcs.scm_app_implementation', 'http') |
@@ -74,6 +74,7 b' from webhelpers2.html.tags import (' | |||||
74 |
|
74 | |||
75 | from webhelpers2.number import format_byte_size |
|
75 | from webhelpers2.number import format_byte_size | |
76 | # python3.11 backport fixes for webhelpers2 |
|
76 | # python3.11 backport fixes for webhelpers2 | |
|
77 | from rhodecode import ConfigGet | |||
77 | from rhodecode.lib._vendor.webhelpers_backports import raw_select |
|
78 | from rhodecode.lib._vendor.webhelpers_backports import raw_select | |
78 |
|
79 | |||
79 | from rhodecode.lib.action_parser import action_parser |
|
80 | from rhodecode.lib.action_parser import action_parser | |
@@ -916,9 +917,7 b' def get_repo_type_by_name(repo_name):' | |||||
916 |
|
917 | |||
917 | def is_svn_without_proxy(repository): |
|
918 | def is_svn_without_proxy(repository): | |
918 | if is_svn(repository): |
|
919 | if is_svn(repository): | |
919 | from rhodecode.model.settings import VcsSettingsModel |
|
920 | return not ConfigGet().get_bool('vcs.svn.proxy.enabled') | |
920 | conf = VcsSettingsModel().get_ui_settings_as_config_obj() |
|
|||
921 | return not str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled')) |
|
|||
922 | return False |
|
921 | return False | |
923 |
|
922 | |||
924 |
|
923 |
@@ -27,6 +27,7 b' import urllib.parse' | |||||
27 | import requests |
|
27 | import requests | |
28 | from pyramid.httpexceptions import HTTPNotAcceptable |
|
28 | from pyramid.httpexceptions import HTTPNotAcceptable | |
29 |
|
29 | |||
|
30 | from rhodecode import ConfigGet | |||
30 | from rhodecode.lib import rc_cache |
|
31 | from rhodecode.lib import rc_cache | |
31 | from rhodecode.lib.middleware import simplevcs |
|
32 | from rhodecode.lib.middleware import simplevcs | |
32 | from rhodecode.lib.middleware.utils import get_path_info |
|
33 | from rhodecode.lib.middleware.utils import get_path_info | |
@@ -232,12 +233,10 b' class SimpleSvn(simplevcs.SimpleVCS):' | |||||
232 | return DisabledSimpleSvnApp(config) |
|
233 | return DisabledSimpleSvnApp(config) | |
233 |
|
234 | |||
234 | def _is_svn_enabled(self): |
|
235 | def _is_svn_enabled(self): | |
235 | conf = self.repo_vcs_config |
|
236 | return ConfigGet().get_bool('vcs.svn.proxy.enabled') | |
236 | return str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled')) |
|
|||
237 |
|
237 | |||
238 | def _create_config(self, extras, repo_name, scheme='http'): |
|
238 | def _create_config(self, extras, repo_name, scheme='http'): | |
239 | conf = self.repo_vcs_config |
|
239 | server_url = ConfigGet().get_str('vcs.svn.proxy.host') | |
240 | server_url = conf.get('vcs_svn_proxy', 'http_server_url') |
|
|||
241 | server_url = server_url or self.DEFAULT_HTTP_SERVER |
|
240 | server_url = server_url or self.DEFAULT_HTTP_SERVER | |
242 |
|
241 | |||
243 | extras['subversion_http_server_url'] = server_url |
|
242 | extras['subversion_http_server_url'] = server_url |
@@ -421,10 +421,6 b' class _BaseVcsSettingsForm(formencode.Sc' | |||||
421 | rhodecode_git_use_rebase_for_merging = v.StringBoolean(if_missing=False) |
|
421 | rhodecode_git_use_rebase_for_merging = v.StringBoolean(if_missing=False) | |
422 | rhodecode_git_close_branch_before_merging = v.StringBoolean(if_missing=False) |
|
422 | rhodecode_git_close_branch_before_merging = v.StringBoolean(if_missing=False) | |
423 |
|
423 | |||
424 | # svn |
|
|||
425 | vcs_svn_proxy_http_requests_enabled = v.StringBoolean(if_missing=False) |
|
|||
426 | vcs_svn_proxy_http_server_url = v.UnicodeString(strip=True, if_missing=None) |
|
|||
427 |
|
||||
428 | # cache |
|
424 | # cache | |
429 | rhodecode_diff_cache = v.StringBoolean(if_missing=False) |
|
425 | rhodecode_diff_cache = v.StringBoolean(if_missing=False) | |
430 |
|
426 |
@@ -499,11 +499,6 b' class VcsSettingsModel(object):' | |||||
499 | ('vcs_git_lfs', 'store_location') |
|
499 | ('vcs_git_lfs', 'store_location') | |
500 | ) |
|
500 | ) | |
501 |
|
501 | |||
502 | GLOBAL_SVN_SETTINGS = ( |
|
|||
503 | ('vcs_svn_proxy', 'http_requests_enabled'), |
|
|||
504 | ('vcs_svn_proxy', 'http_server_url') |
|
|||
505 | ) |
|
|||
506 |
|
||||
507 | SVN_BRANCH_SECTION = 'vcs_svn_branch' |
|
502 | SVN_BRANCH_SECTION = 'vcs_svn_branch' | |
508 | SVN_TAG_SECTION = 'vcs_svn_tag' |
|
503 | SVN_TAG_SECTION = 'vcs_svn_tag' | |
509 | SSL_SETTING = ('web', 'push_ssl') |
|
504 | SSL_SETTING = ('web', 'push_ssl') | |
@@ -718,17 +713,6 b' class VcsSettingsModel(object):' | |||||
718 | # branch/tags patterns |
|
713 | # branch/tags patterns | |
719 | self._create_svn_settings(self.global_settings, data) |
|
714 | self._create_svn_settings(self.global_settings, data) | |
720 |
|
715 | |||
721 | http_requests_enabled, http_server_url = self.GLOBAL_SVN_SETTINGS |
|
|||
722 | http_requests_enabled_key, http_server_url_key = self._get_settings_keys( |
|
|||
723 | self.GLOBAL_SVN_SETTINGS, data) |
|
|||
724 |
|
||||
725 | self._create_or_update_ui( |
|
|||
726 | self.global_settings, *http_requests_enabled, |
|
|||
727 | value=safe_str(data[http_requests_enabled_key])) |
|
|||
728 | self._create_or_update_ui( |
|
|||
729 | self.global_settings, *http_server_url, |
|
|||
730 | value=data[http_server_url_key]) |
|
|||
731 |
|
||||
732 | def update_global_ssl_setting(self, value): |
|
716 | def update_global_ssl_setting(self, value): | |
733 | self._create_or_update_ui( |
|
717 | self._create_or_update_ui( | |
734 | self.global_settings, *self.SSL_SETTING, value=value) |
|
718 | self.global_settings, *self.SSL_SETTING, value=value) |
@@ -170,42 +170,6 b'' | |||||
170 | </div> |
|
170 | </div> | |
171 | % endif |
|
171 | % endif | |
172 |
|
172 | |||
173 |
|
||||
174 | % if display_globals: |
|
|||
175 | <div class="panel panel-default"> |
|
|||
176 | <div class="panel-heading" id="vcs-global-svn-options"> |
|
|||
177 | <h3 class="panel-title">${_('Global Subversion Settings')}<a class="permalink" href="#vcs-global-svn-options"> ¶</a></h3> |
|
|||
178 | </div> |
|
|||
179 | <div class="panel-body"> |
|
|||
180 | <div class="field"> |
|
|||
181 | <div class="checkbox"> |
|
|||
182 | ${h.checkbox('vcs_svn_proxy_http_requests_enabled' + suffix, 'True', **kwargs)} |
|
|||
183 | <label for="vcs_svn_proxy_http_requests_enabled${suffix}">${_('Proxy subversion HTTP requests')}</label> |
|
|||
184 | </div> |
|
|||
185 | <div class="label"> |
|
|||
186 | <span class="help-block"> |
|
|||
187 | ${_('Subversion HTTP Support. Enables communication with SVN over HTTP protocol.')} |
|
|||
188 | <a href="${h.route_url('enterprise_svn_setup')}" target="_blank">${_('SVN Protocol setup Documentation')}</a>. |
|
|||
189 | </span> |
|
|||
190 | </div> |
|
|||
191 | </div> |
|
|||
192 | <div class="field"> |
|
|||
193 | <div class="label"> |
|
|||
194 | <label for="vcs_svn_proxy_http_server_url">${_('Subversion HTTP Server URL')}</label><br/> |
|
|||
195 | </div> |
|
|||
196 | <div class="input"> |
|
|||
197 | ${h.text('vcs_svn_proxy_http_server_url',size=59)} |
|
|||
198 | % if c.svn_proxy_generate_config: |
|
|||
199 | <span class="buttons"> |
|
|||
200 | <button class="btn btn-primary" id="vcs_svn_generate_cfg">${_('Generate Apache Config')}</button> |
|
|||
201 | </span> |
|
|||
202 | % endif |
|
|||
203 | </div> |
|
|||
204 | </div> |
|
|||
205 | </div> |
|
|||
206 | </div> |
|
|||
207 | % endif |
|
|||
208 |
|
||||
209 | % if display_globals or repo_type in ['svn']: |
|
173 | % if display_globals or repo_type in ['svn']: | |
210 | <div class="panel panel-default"> |
|
174 | <div class="panel panel-default"> | |
211 | <div class="panel-heading" id="vcs-svn-options"> |
|
175 | <div class="panel-heading" id="vcs-svn-options"> |
@@ -108,6 +108,7 b' def ini_config(request, tmpdir_factory, ' | |||||
108 |
|
108 | |||
109 | 'vcs.server.protocol': 'http', |
|
109 | 'vcs.server.protocol': 'http', | |
110 | 'vcs.scm_app_implementation': 'http', |
|
110 | 'vcs.scm_app_implementation': 'http', | |
|
111 | 'vcs.svn.proxy.enabled': 'true', | |||
111 | 'vcs.hooks.protocol': 'http', |
|
112 | 'vcs.hooks.protocol': 'http', | |
112 | 'vcs.hooks.host': '*', |
|
113 | 'vcs.hooks.host': '*', | |
113 | 'app.service_api.token': 'service_secret_token', |
|
114 | 'app.service_api.token': 'service_secret_token', |
General Comments 0
You need to be logged in to leave comments.
Login now