# HG changeset patch # User Marcin Kuzminski # Date 2020-01-21 09:19:29 # Node ID 9425ab17ceb5429e4375846ce04f28094ca511d3 # Parent aaf1da2101d10ccdaeaa827b043d5f2dfa8b224b maintainance: run rebuildfncache for Mercurial. diff --git a/rhodecode/lib/repo_maintenance.py b/rhodecode/lib/repo_maintenance.py --- a/rhodecode/lib/repo_maintenance.py +++ b/rhodecode/lib/repo_maintenance.py @@ -148,6 +148,15 @@ class HGUpdateCaches(MaintenanceTask): return res +class HGRebuildFnCaches(MaintenanceTask): + human_name = 'HG rebuild fn caches' + + def run(self): + instance = self.db_repo.scm_instance() + res = instance.hg_rebuild_fn_cache() + return res + + class SVNVerify(MaintenanceTask): human_name = 'SVN Verify repo' @@ -162,7 +171,7 @@ class RepoMaintenance(object): Performs maintenance of repository based on it's type """ tasks = { - 'hg': [HGVerify, HGUpdateCaches], + 'hg': [HGVerify, HGUpdateCaches, HGRebuildFnCaches], 'git': [GitFSCK, GitGC, GitRepack], 'svn': [SVNVerify], } diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py --- a/rhodecode/lib/vcs/backends/hg/repository.py +++ b/rhodecode/lib/vcs/backends/hg/repository.py @@ -290,6 +290,12 @@ class MercurialRepository(BaseRepository self._remote.invalidate_vcs_cache() return update_cache + def hg_rebuild_fn_cache(self): + update_cache = self._remote.hg_rebuild_fn_cache() + + self._remote.invalidate_vcs_cache() + return update_cache + def get_common_ancestor(self, commit_id1, commit_id2, repo2): if commit_id1 == commit_id2: return commit_id1