# HG changeset patch # User Marcin Kuzminski # Date 2017-08-15 19:33:01 # Node ID b9fd9a54fa23dd0753d13f7926aa39c92b2da69d # Parent 7f42b8f2a0129b395ec74795d50ee4d49cdcb553 goto-switcher: use special commit: prefix to explicitly search for commits. - previous solution could make the go-to swticher slow in case of huge search index - mixing repository names and commit names could lead to bad UX when searching - explicit case still allows this, but user is in the control how and what he wants to search - fixes #5375 diff --git a/rhodecode/apps/home/views.py b/rhodecode/apps/home/views.py --- a/rhodecode/apps/home/views.py +++ b/rhodecode/apps/home/views.py @@ -146,15 +146,16 @@ class HomeView(BaseAppView): 'text': obj.group_name, 'type': 'group', 'obj': {}, - 'url': h.route_path('repo_group_home', repo_group_name=obj.group_name) + 'url': h.route_path( + 'repo_group_home', repo_group_name=obj.group_name) } for obj in repo_groups_iter] - def _get_hash_commit_list(self, auth_user, hash_starts_with=None): - if not hash_starts_with or len(hash_starts_with) < 3: + def _get_hash_commit_list(self, auth_user, query=None): + if not query or len(query) < 3: return [] - commit_hashes = re.compile('([0-9a-f]{2,40})').findall(hash_starts_with) + commit_hashes = re.compile('(?:commit:)([0-9a-f]{2,40})').findall(query) if len(commit_hashes) != 1: return [] @@ -172,9 +173,9 @@ class HomeView(BaseAppView): 'text': entry['commit_id'], 'type': 'commit', 'obj': {'repo': entry['repository']}, - 'url': h.route_path('repo_commit', - repo_name=entry['repository'], - commit_id=entry['commit_id']) + 'url': h.route_path( + 'repo_commit', + repo_name=entry['repository'], commit_id=entry['commit_id']) } for entry in result['results']]