maintainance: added update caches to mercurial.

This commit is contained in:
Marcin Kuzminski 2019-09-11 12:02:03 +02:00
parent 3e5a351479
commit d28e645e15
2 changed files with 16 additions and 1 deletions

View file

@ -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],
}

View file

@ -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