##// END OF EJS Templates
feat(svn-config): updated with the latest changes.
ilin.s -
r5329:086492de merge default
parent child Browse files
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 # Copyright (C) 2010-2023 RhodeCode GmbH
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,13 +51,13 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):
59 response = self.app.get(
60 response = self.app.get(
60 route_path('repo_summary', repo_name=repo_name))
61 route_path('repo_summary', repo_name=repo_name))
62
61
63 # repo type
62 # repo type
64 response.mustcontain(
63 response.mustcontain(
@@ -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, '_{}'.format(repo_id))
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, '_{}'.format(repo_id), disabled=True)
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):
98 response = self.app.get(
93 response = self.app.get(
99 route_path('repo_summary', repo_name=repo_name) + trailing_slash,
94 route_path('repo_summary', repo_name=repo_name) + '/',
100 status=200)
95 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, '_{}'.format(repo_id))
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='_%s' % (repo_id,)))
109 route_path('repo_summary', repo_name=f'_{repo_id}'))
105
110
106 # repo type
111 # repo type
107 response.mustcontain(
112 response.mustcontain(
@@ -242,9 +242,10 b' class SubversionServer(SshVcsServer):'
242 # if exit_code:
242 # if exit_code:
243 # return exit_code, False
243 # return exit_code, False
244
244
245 req = self.env['request']
245 req = self.env.get('request')
246 server_url = req.host_url + req.script_name
246 if req:
247 extras['server_url'] = server_url
247 server_url = req.host_url + req.script_name
248 extras['server_url'] = server_url
248
249
249 log.debug('Using %s binaries from path %s', self.backend, self._path)
250 log.debug('Using %s binaries from path %s', self.backend, self._path)
250 exit_code = self.tunnel.run(extras)
251 exit_code = self.tunnel.run(extras)
@@ -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
@@ -231,12 +232,10 b' class SimpleSvn(simplevcs.SimpleVCS):'
231 return DisabledSimpleSvnApp(config)
232 return DisabledSimpleSvnApp(config)
232
233
233 def _is_svn_enabled(self):
234 def _is_svn_enabled(self):
234 conf = self.repo_vcs_config
235 return ConfigGet().get_bool('vcs.svn.proxy.enabled')
235 return str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled'))
236
236
237 def _create_config(self, extras, repo_name, scheme='http'):
237 def _create_config(self, extras, repo_name, scheme='http'):
238 conf = self.repo_vcs_config
238 server_url = ConfigGet().get_str('vcs.svn.proxy.host')
239 server_url = conf.get('vcs_svn_proxy', 'http_server_url')
240 server_url = server_url or self.DEFAULT_HTTP_SERVER
239 server_url = server_url or self.DEFAULT_HTTP_SERVER
241
240
242 extras['subversion_http_server_url'] = server_url
241 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