##// 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 1 # Copyright (C) 2010-2020 RhodeCode GmbH
4 2 #
5 3 # This program is free software: you can redistribute it and/or modify
@@ -71,7 +69,7 b' class SettingsMaker(object):'
71 69
72 70 # ensure we have our dir created
73 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 74 if not os.path.isdir(input_val):
77 75 raise Exception('Dir at {} does not exist'.format(input_val))
@@ -1,5 +1,3 b''
1 # -*- coding: utf-8 -*-
2
3 1 # RhodeCode VCSServer provides access to different vcs backends via network.
4 2 # Copyright (C) 2014-2020 RhodeCode GmbH
5 3 #
@@ -147,6 +147,7 b' class SvnMessageWriter(RemoteMessageWrit'
147 147 def _handle_exception(result):
148 148 exception_class = result.get('exception')
149 149 exception_traceback = result.get('exception_traceback')
150 log.debug('Handling hook-call exception: %s', exception_class)
150 151
151 152 if exception_traceback:
152 153 log.error('Got traceback from remote call:%s', exception_traceback)
@@ -166,6 +167,7 b' def _handle_exception(result):'
166 167 def _get_hooks_client(extras):
167 168 hooks_uri = extras.get('hooks_uri')
168 169 is_shadow_repo = extras.get('is_shadow_repo')
170
169 171 if hooks_uri:
170 172 return HooksHttpClient(extras['hooks_uri'])
171 173 elif is_shadow_repo:
@@ -82,7 +82,7 b' class GitRepository(object):'
82 82 valid_dir_signature = self.git_folder_signature.issubset(files)
83 83
84 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 87 self.content_path = content_path
88 88 self.repo_name = repo_name
@@ -229,6 +229,8 b' class GitRepository(object):'
229 229 header_injected = 0
230 230 next_item = None
231 231 has_item = False
232 item = b''
233
232 234 while do_loop:
233 235
234 236 try:
@@ -245,6 +247,7 b' class GitRepository(object):'
245 247 item = b''.join(new_response)
246 248
247 249 yield item
250
248 251 has_item = True
249 252 item = next_item
250 253
@@ -1,5 +1,3 b''
1 # -*- coding: utf-8 -*-
2
3 1 # Copyright (C) 2016-2020 RhodeCode GmbH
4 2 #
5 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 59 elif obj is None:
60 60 return []
61 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 43 if delete:
44 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 47 return {'invalidated': {'repo_id': repo_id, 'delete': delete}}
General Comments 0
You need to be logged in to leave comments. Login now