Show More
@@ -910,8 +910,7 b' def add_field_to_repo(request, apiuser, ' | |||
|
910 | 910 | |
|
911 | 911 | field = RepositoryField.get_by_key_name(key, repo) |
|
912 | 912 | if field: |
|
913 | raise JSONRPCError('Field with key ' | |
|
914 | '`%s` exists for repo `%s`' % (key, repoid)) | |
|
913 | raise JSONRPCError(f'Field with key `{key}` exists for repo `{repoid}`') | |
|
915 | 914 | |
|
916 | 915 | try: |
|
917 | 916 | RepoModel().add_repo_field(repo, key, field_label=label, |
@@ -20,13 +20,11 b'' | |||
|
20 | 20 | import pytest |
|
21 | 21 | import mock |
|
22 | 22 | |
|
23 | from rhodecode.apps._base import ADMIN_PREFIX | |
|
24 | from rhodecode.lib import helpers as h | |
|
25 | 23 | from rhodecode.lib.auth import check_password |
|
26 | 24 | from rhodecode.model.meta import Session |
|
27 | 25 | from rhodecode.model.user import UserModel |
|
28 | from rhodecode.tests import assert_session_flash | |
|
29 |
from rhodecode.tests.fixture import Fixture, |
|
|
26 | from rhodecode.tests import assert_session_flash, TestController | |
|
27 | from rhodecode.tests.fixture import Fixture, error_function | |
|
30 | 28 | from rhodecode.tests.routes import route_path |
|
31 | 29 | |
|
32 | 30 | fixture = Fixture() |
@@ -265,8 +265,7 b' def memory():' | |||
|
265 | 265 | |
|
266 | 266 | value.update(dict(psutil.virtual_memory()._asdict())) |
|
267 | 267 | value['used_real'] = value['total'] - value['available'] |
|
268 | value['percent_used'] = psutil._common.usage_percent( | |
|
269 | value['used_real'], value['total'], 1) | |
|
268 | value['percent_used'] = psutil._common.usage_percent(value['used_real'], value['total'], 1) | |
|
270 | 269 | |
|
271 | 270 | human_value = value.copy() |
|
272 | 271 | human_value['text'] = '{}/{}, {}% used'.format( |
@@ -324,8 +323,7 b' def cpu():' | |||
|
324 | 323 | value['cpu_count'] = psutil.cpu_count() |
|
325 | 324 | |
|
326 | 325 | human_value = value.copy() |
|
327 | human_value['text'] = '{} cores at {} %'.format( | |
|
328 | value['cpu_count'], value['cpu']) | |
|
326 | human_value['text'] = '{} cores at {} %'.format(value['cpu_count'], value['cpu']) | |
|
329 | 327 | |
|
330 | 328 | return SysInfoRes(value=value, state=state, human_value=human_value) |
|
331 | 329 | |
@@ -784,10 +782,10 b' def server_info(environ):' | |||
|
784 | 782 | |
|
785 | 783 | @register_sysinfo |
|
786 | 784 | def usage_info(): |
|
787 | from rhodecode.model.db import User, Repository | |
|
785 | from rhodecode.model.db import User, Repository, true | |
|
788 | 786 | value = { |
|
789 | 787 | 'users': User.query().count(), |
|
790 |
'users_active': User.query().filter(User.active == |
|
|
788 | 'users_active': User.query().filter(User.active == true()).count(), | |
|
791 | 789 | 'repositories': Repository.query().count(), |
|
792 | 790 | 'repository_types': { |
|
793 | 791 | 'hg': Repository.query().filter( |
@@ -969,7 +969,7 b' def user_agent_normalizer(user_agent_raw' | |||
|
969 | 969 | |
|
970 | 970 | def get_available_port(min_port=40000, max_port=55555, use_range=False): |
|
971 | 971 | hostname = '' |
|
972 | for _ in range(min_port, max_port): | |
|
972 | for _check_port in range(min_port, max_port): | |
|
973 | 973 | pick_port = 0 |
|
974 | 974 | if use_range: |
|
975 | 975 | pick_port = random.randint(min_port, max_port) |
@@ -979,9 +979,9 b' def get_available_port(min_port=40000, m' | |||
|
979 | 979 | s.bind((hostname, pick_port)) |
|
980 | 980 | s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
|
981 | 981 | return s.getsockname()[1] |
|
982 | except OSError: | |
|
983 | continue | |
|
984 | 982 | except socket.error as e: |
|
985 | 983 | if e.args[0] in [errno.EADDRINUSE, errno.ECONNREFUSED]: |
|
986 | 984 | continue |
|
987 | 985 | raise |
|
986 | except OSError: | |
|
987 | continue |
@@ -237,7 +237,7 b' class MergeResponse(object):' | |||
|
237 | 237 | |
|
238 | 238 | } |
|
239 | 239 | |
|
240 | def __init__(self, possible, executed, merge_ref, failure_reason, metadata=None): | |
|
240 | def __init__(self, possible, executed, merge_ref: Reference, failure_reason, metadata=None): | |
|
241 | 241 | self.possible = possible |
|
242 | 242 | self.executed = executed |
|
243 | 243 | self.merge_ref = merge_ref |
@@ -954,6 +954,7 b' class GitRepository(BaseRepository):' | |||
|
954 | 954 | |
|
955 | 955 | log.debug('Executing merge_repo with %s strategy, dry_run mode:%s', |
|
956 | 956 | 'rebase' if use_rebase else 'merge', dry_run) |
|
957 | ||
|
957 | 958 | if target_ref.commit_id != self.branches[target_ref.name]: |
|
958 | 959 | log.warning('Target ref %s commit mismatch %s vs %s', target_ref, |
|
959 | 960 | target_ref.commit_id, self.branches[target_ref.name]) |
@@ -28,7 +28,6 b' import shutil' | |||
|
28 | 28 | import configparser |
|
29 | 29 | |
|
30 | 30 | from rhodecode.model.settings import SettingsModel |
|
31 | from rhodecode.tests import * | |
|
32 | 31 | from rhodecode.model.db import Repository, User, RepoGroup, UserGroup, Gist, UserEmailMap |
|
33 | 32 | from rhodecode.model.meta import Session |
|
34 | 33 | from rhodecode.model.repo import RepoModel |
@@ -41,6 +40,8 b' from rhodecode.model.scm import ScmModel' | |||
|
41 | 40 | from rhodecode.authentication.plugins.auth_rhodecode import \ |
|
42 | 41 | RhodeCodeAuthPlugin |
|
43 | 42 | |
|
43 | from rhodecode.tests import TEST_USER_ADMIN_LOGIN | |
|
44 | ||
|
44 | 45 | dn = os.path.dirname |
|
45 | 46 | FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'tests', 'fixtures') |
|
46 | 47 | |
@@ -291,7 +292,7 b' class Fixture(object):' | |||
|
291 | 292 | repo_type=repo_to_fork.repo_type, |
|
292 | 293 | **kwargs) |
|
293 | 294 | |
|
294 | #TODO: fix it !! | |
|
295 | # TODO: fix it !! | |
|
295 | 296 | form_data['description'] = form_data['repo_description'] |
|
296 | 297 | form_data['private'] = form_data['repo_private'] |
|
297 | 298 | form_data['landing_rev'] = form_data['repo_landing_commit_ref'] |
@@ -27,10 +27,11 b' from rhodecode.lib.diffs import (' | |||
|
27 | 27 | DiffProcessor, |
|
28 | 28 | NEW_FILENODE, DEL_FILENODE, MOD_FILENODE, RENAMED_FILENODE, |
|
29 | 29 | CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE) |
|
30 | from rhodecode.lib.str_utils import safe_bytes | |
|
30 | ||
|
31 | 31 | from rhodecode.lib.utils2 import AttributeDict |
|
32 | 32 | from rhodecode.lib.vcs.backends.git import GitCommit |
|
33 |
from rhodecode.tests.fixture import Fixture |
|
|
33 | from rhodecode.tests.fixture import Fixture | |
|
34 | from rhodecode.tests import no_newline_id_generator | |
|
34 | 35 | from rhodecode.lib.vcs.backends.git.repository import GitDiff |
|
35 | 36 | from rhodecode.lib.vcs.backends.hg.repository import MercurialDiff |
|
36 | 37 | from rhodecode.lib.vcs.backends.svn.repository import SubversionDiff |
General Comments 0
You need to be logged in to leave comments.
Login now