##// END OF EJS Templates
core: various cleanups and fixes
super-admin -
r1118:c35e966b python3
parent child Browse files
Show More
@@ -0,0 +1,27 b''
1 # Copyright (C) 2010-2020 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
19 HOOK_REPO_SIZE = 'changegroup.repo_size'
20
21 # HG
22 HOOK_PRE_PULL = 'preoutgoing.pre_pull'
23 HOOK_PULL = 'outgoing.pull_logger'
24 HOOK_PRE_PUSH = 'prechangegroup.pre_push'
25 HOOK_PRETX_PUSH = 'pretxnchangegroup.pre_push'
26 HOOK_PUSH = 'changegroup.push_logger'
27 HOOK_PUSH_KEY = 'pushkey.key_push'
@@ -1,5 +1,3 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2010-2020 RhodeCode GmbH
1 # Copyright (C) 2010-2020 RhodeCode GmbH
4 #
2 #
5 # 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
@@ -71,7 +69,7 b' class SettingsMaker(object):'
71
69
72 # ensure we have our dir created
70 # ensure we have our dir created
73 if not os.path.isdir(input_val) and ensure_dir:
71 if not os.path.isdir(input_val) and ensure_dir:
74 os.makedirs(input_val, mode=mode)
72 os.makedirs(input_val, mode=mode, exist_ok=True)
75
73
76 if not os.path.isdir(input_val):
74 if not os.path.isdir(input_val):
77 raise Exception('Dir at {} does not exist'.format(input_val))
75 raise Exception('Dir at {} does not exist'.format(input_val))
@@ -116,7 +116,7 b' def lfs_objects_batch(request):'
116
116
117 obj_data = {'oid': oid}
117 obj_data = {'oid': oid}
118
118
119 obj_href = request.route_url('lfs_objects_oid', repo=repo, oid=oid,
119 obj_href = request.route_url('lfs_objects_oid', repo=repo, oid=oid,
120 _scheme=http_scheme)
120 _scheme=http_scheme)
121 obj_verify_href = request.route_url('lfs_objects_verify', repo=repo,
121 obj_verify_href = request.route_url('lfs_objects_verify', repo=repo,
122 _scheme=http_scheme)
122 _scheme=http_scheme)
@@ -1,5 +1,3 b''
1 # -*- coding: utf-8 -*-
2
3 # RhodeCode VCSServer provides access to different vcs backends via network.
1 # RhodeCode VCSServer provides access to different vcs backends via network.
4 # Copyright (C) 2014-2020 RhodeCode GmbH
2 # Copyright (C) 2014-2020 RhodeCode GmbH
5 #
3 #
@@ -147,6 +147,7 b' class SvnMessageWriter(RemoteMessageWrit'
147 def _handle_exception(result):
147 def _handle_exception(result):
148 exception_class = result.get('exception')
148 exception_class = result.get('exception')
149 exception_traceback = result.get('exception_traceback')
149 exception_traceback = result.get('exception_traceback')
150 log.debug('Handling hook-call exception: %s', exception_class)
150
151
151 if exception_traceback:
152 if exception_traceback:
152 log.error('Got traceback from remote call:%s', exception_traceback)
153 log.error('Got traceback from remote call:%s', exception_traceback)
@@ -166,6 +167,7 b' def _handle_exception(result):'
166 def _get_hooks_client(extras):
167 def _get_hooks_client(extras):
167 hooks_uri = extras.get('hooks_uri')
168 hooks_uri = extras.get('hooks_uri')
168 is_shadow_repo = extras.get('is_shadow_repo')
169 is_shadow_repo = extras.get('is_shadow_repo')
170
169 if hooks_uri:
171 if hooks_uri:
170 return HooksHttpClient(extras['hooks_uri'])
172 return HooksHttpClient(extras['hooks_uri'])
171 elif is_shadow_repo:
173 elif is_shadow_repo:
@@ -82,7 +82,7 b' class GitRepository(object):'
82 valid_dir_signature = self.git_folder_signature.issubset(files)
82 valid_dir_signature = self.git_folder_signature.issubset(files)
83
83
84 if not valid_dir_signature:
84 if not valid_dir_signature:
85 raise OSError('%s missing git signature' % content_path)
85 raise OSError(f'{content_path} missing git signature')
86
86
87 self.content_path = content_path
87 self.content_path = content_path
88 self.repo_name = repo_name
88 self.repo_name = repo_name
@@ -229,6 +229,8 b' class GitRepository(object):'
229 header_injected = 0
229 header_injected = 0
230 next_item = None
230 next_item = None
231 has_item = False
231 has_item = False
232 item = b''
233
232 while do_loop:
234 while do_loop:
233
235
234 try:
236 try:
@@ -245,6 +247,7 b' class GitRepository(object):'
245 item = b''.join(new_response)
247 item = b''.join(new_response)
246
248
247 yield item
249 yield item
250
248 has_item = True
251 has_item = True
249 item = next_item
252 item = next_item
250
253
@@ -1,5 +1,3 b''
1 # -*- coding: utf-8 -*-
2
3 # Copyright (C) 2016-2020 RhodeCode GmbH
1 # Copyright (C) 2016-2020 RhodeCode GmbH
4 #
2 #
5 # 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
@@ -59,4 +59,9 b' def aslist(obj, sep=None, strip=True) ->'
59 elif obj is None:
59 elif obj is None:
60 return []
60 return []
61 else:
61 else:
62 return [obj] No newline at end of file
62 return [obj]
63
64
65 def assert_bytes(input_type, expected_types=(bytes,)):
66 if not isinstance(input_type, expected_types):
67 raise ValueError(f'input_types should be one of {expected_types} got {type(input_type)} instead')
@@ -42,6 +42,6 b' class RemoteBase(object):'
42
42
43 if delete:
43 if delete:
44 rc_cache.clear_cache_namespace(
44 rc_cache.clear_cache_namespace(
45 'repo_object', cache_namespace_uid, invalidate=True)
45 'repo_object', cache_namespace_uid, method=rc_cache.CLEAR_DELETE)
46
46
47 return {'invalidated': {'repo_id': repo_id, 'delete': delete}}
47 return {'invalidated': {'repo_id': repo_id, 'delete': delete}}
General Comments 0
You need to be logged in to leave comments. Login now