##// 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 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 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 624 ; Cache flag to cache vcsserver remote calls locally
619 625 ; It uses cache_region `cache_repo`
620 626 vcs.methods.cache = true
@@ -566,6 +566,12 b' vcs.connection_timeout = 3600'
566 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 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 575 ; Cache flag to cache vcsserver remote calls locally
570 576 ; It uses cache_region `cache_repo`
571 577 vcs.methods.cache = true
@@ -1,4 +1,3 b''
1
2 1 # Copyright (C) 2010-2023 RhodeCode GmbH
3 2 #
4 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 52 @pytest.mark.usefixtures('app')
54 53 class TestSummaryView(object):
54
55 55 def test_index(self, autologin_user, backend, http_host_only_stub):
56 56 repo_id = backend.repo.repo_id
57 57 repo_name = backend.repo_name
58 with mock.patch('rhodecode.lib.helpers.is_svn_without_proxy',
59 return_value=False):
60 response = self.app.get(
61 route_path('repo_summary', repo_name=repo_name))
58
59 response = self.app.get(
60 route_path('repo_summary', repo_name=repo_name))
62 61
63 62 # repo type
64 63 response.mustcontain(
@@ -71,37 +70,43 b' class TestSummaryView(object):'
71 70
72 71 # clone url...
73 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 75 def test_index_svn_without_proxy(
77 76 self, autologin_user, backend_svn, http_host_only_stub):
77
78 78 repo_id = backend_svn.repo.repo_id
79 79 repo_name = backend_svn.repo_name
80 response = self.app.get(route_path('repo_summary', repo_name=repo_name))
81 # clone url...
80
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 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 92 def test_index_with_trailing_slash(
87 93 self, autologin_user, backend, http_host_only_stub):
88 94
89 95 repo_id = backend.repo.repo_id
90 96 repo_name = backend.repo_name
91 with mock.patch('rhodecode.lib.helpers.is_svn_without_proxy',
92 return_value=False):
93 response = self.app.get(
94 route_path('repo_summary', repo_name=repo_name) + '/',
95 status=200)
97 trailing_slash = '/'
98 response = self.app.get(
99 route_path('repo_summary', repo_name=repo_name) + trailing_slash,
100 status=200)
96 101
97 102 # clone url...
98 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 106 def test_index_by_id(self, autologin_user, backend):
102 107 repo_id = backend.repo.repo_id
103 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 111 # repo type
107 112 response.mustcontain(
@@ -242,9 +242,10 b' class SubversionServer(SshVcsServer):'
242 242 # if exit_code:
243 243 # return exit_code, False
244 244
245 req = self.env['request']
246 server_url = req.host_url + req.script_name
247 extras['server_url'] = server_url
245 req = self.env.get('request')
246 if req:
247 server_url = req.host_url + req.script_name
248 extras['server_url'] = server_url
248 249
249 250 log.debug('Using %s binaries from path %s', self.backend, self._path)
250 251 exit_code = self.tunnel.run(extras)
@@ -74,6 +74,7 b' from webhelpers2.html.tags import ('
74 74
75 75 from webhelpers2.number import format_byte_size
76 76 # python3.11 backport fixes for webhelpers2
77 from rhodecode import ConfigGet
77 78 from rhodecode.lib._vendor.webhelpers_backports import raw_select
78 79
79 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 918 def is_svn_without_proxy(repository):
918 919 if is_svn(repository):
919 from rhodecode.model.settings import VcsSettingsModel
920 conf = VcsSettingsModel().get_ui_settings_as_config_obj()
921 return not str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled'))
920 return not ConfigGet().get_bool('vcs.svn.proxy.enabled')
922 921 return False
923 922
924 923
@@ -27,6 +27,7 b' import urllib.parse'
27 27 import requests
28 28 from pyramid.httpexceptions import HTTPNotAcceptable
29 29
30 from rhodecode import ConfigGet
30 31 from rhodecode.lib import rc_cache
31 32 from rhodecode.lib.middleware import simplevcs
32 33 from rhodecode.lib.middleware.utils import get_path_info
@@ -231,12 +232,10 b' class SimpleSvn(simplevcs.SimpleVCS):'
231 232 return DisabledSimpleSvnApp(config)
232 233
233 234 def _is_svn_enabled(self):
234 conf = self.repo_vcs_config
235 return str2bool(conf.get('vcs_svn_proxy', 'http_requests_enabled'))
235 return ConfigGet().get_bool('vcs.svn.proxy.enabled')
236 236
237 237 def _create_config(self, extras, repo_name, scheme='http'):
238 conf = self.repo_vcs_config
239 server_url = conf.get('vcs_svn_proxy', 'http_server_url')
238 server_url = ConfigGet().get_str('vcs.svn.proxy.host')
240 239 server_url = server_url or self.DEFAULT_HTTP_SERVER
241 240
242 241 extras['subversion_http_server_url'] = server_url
@@ -421,10 +421,6 b' class _BaseVcsSettingsForm(formencode.Sc'
421 421 rhodecode_git_use_rebase_for_merging = v.StringBoolean(if_missing=False)
422 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 424 # cache
429 425 rhodecode_diff_cache = v.StringBoolean(if_missing=False)
430 426
@@ -499,11 +499,6 b' class VcsSettingsModel(object):'
499 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 502 SVN_BRANCH_SECTION = 'vcs_svn_branch'
508 503 SVN_TAG_SECTION = 'vcs_svn_tag'
509 504 SSL_SETTING = ('web', 'push_ssl')
@@ -718,17 +713,6 b' class VcsSettingsModel(object):'
718 713 # branch/tags patterns
719 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 716 def update_global_ssl_setting(self, value):
733 717 self._create_or_update_ui(
734 718 self.global_settings, *self.SSL_SETTING, value=value)
@@ -170,42 +170,6 b''
170 170 </div>
171 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 173 % if display_globals or repo_type in ['svn']:
210 174 <div class="panel panel-default">
211 175 <div class="panel-heading" id="vcs-svn-options">
@@ -108,6 +108,7 b' def ini_config(request, tmpdir_factory, '
108 108
109 109 'vcs.server.protocol': 'http',
110 110 'vcs.scm_app_implementation': 'http',
111 'vcs.svn.proxy.enabled': 'true',
111 112 'vcs.hooks.protocol': 'http',
112 113 'vcs.hooks.host': '*',
113 114 'app.service_api.token': 'service_secret_token',
General Comments 0
You need to be logged in to leave comments. Login now