diff --git a/rhodecode/apps/repository/views/repo_files.py b/rhodecode/apps/repository/views/repo_files.py --- a/rhodecode/apps/repository/views/repo_files.py +++ b/rhodecode/apps/repository/views/repo_files.py @@ -920,8 +920,7 @@ class RepoFilesView(RepoAppView): log.debug('Generating cached nodelist for repo_id:%s, %s, %s', repo_id, commit_id, f_path) try: - _d, _f = ScmModel().get_nodes( - repo_name, commit_id, f_path, flat=False) + _d, _f = ScmModel().get_quick_filter_nodes(repo_name, commit_id, f_path) except (RepositoryError, CommitDoesNotExistError, Exception) as e: log.exception(safe_str(e)) h.flash(safe_str(h.escape(e)), category='error') diff --git a/rhodecode/lib/vcs/nodes.py b/rhodecode/lib/vcs/nodes.py --- a/rhodecode/lib/vcs/nodes.py +++ b/rhodecode/lib/vcs/nodes.py @@ -667,7 +667,7 @@ class DirNode(Node): """ DirNode stores list of files and directories within this node. Nodes may be used standalone but within repository context they - lazily fetch data within same repositorty's commit. + lazily fetch data within same repository's commit. """ def __init__(self, path, nodes=(), commit=None): diff --git a/rhodecode/model/scm.py b/rhodecode/model/scm.py --- a/rhodecode/model/scm.py +++ b/rhodecode/model/scm.py @@ -583,6 +583,42 @@ class ScmModel(BaseModel): return _dirs, _files + def get_quick_filter_nodes(self, repo_name, commit_id, root_path='/'): + """ + Generate files for quick filter in files view + """ + + _files = list() + _dirs = list() + try: + _repo = self._get_repo(repo_name) + commit = _repo.scm_instance().get_commit(commit_id=commit_id) + root_path = root_path.lstrip('/') + for __, dirs, files in commit.walk(root_path): + + for f in files: + + _data = { + "name": h.escape(f.unicode_path), + "type": "file", + } + + _files.append(_data) + + for d in dirs: + + _data = { + "name": h.escape(d.unicode_path), + "type": "dir", + } + + _dirs.append(_data) + except RepositoryError: + log.exception("Exception in get_quick_filter_nodes") + raise + + return _dirs, _files + def get_node(self, repo_name, commit_id, file_path, extended_info=False, content=False, max_file_bytes=None, cache=True): """