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 @@ -139,6 +139,15 @@ class HGVerify(MaintenanceTask): return res +class HGUpdateCaches(MaintenanceTask): + human_name = 'HG update caches' + + def run(self): + instance = self.db_repo.scm_instance() + res = instance.hg_update_cache() + return res + + class SVNVerify(MaintenanceTask): human_name = 'SVN Verify repo' @@ -153,7 +162,7 @@ class RepoMaintenance(object): Performs maintenance of repository based on it's type """ tasks = { - 'hg': [HGVerify], + 'hg': [HGVerify, HGUpdateCaches], '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 @@ -284,6 +284,12 @@ class MercurialRepository(BaseRepository self._remote.invalidate_vcs_cache() return verify + def hg_update_cache(self): + update_cache = self._remote.hg_update_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