From d28e645e15b1d460b7384591083fb41bfcebf8a3 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Wed, 11 Sep 2019 12:02:03 +0200 Subject: [PATCH] maintainance: added update caches to mercurial. --- rhodecode/lib/repo_maintenance.py | 11 ++++++++++- rhodecode/lib/vcs/backends/hg/repository.py | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/rhodecode/lib/repo_maintenance.py b/rhodecode/lib/repo_maintenance.py index 7a2fcdfe..56ea91a6 100644 --- 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 index 7f5e2d14..807a37ac 100644 --- 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