Mercurial > evolve
changeset 3239:0c8c7b5274a5
cache: adds debug details about what the content of the update
Having more data in debug is good, we add a small method to help providing them.
This code was headed for core during the 4.3 cycle but never made it there. So
we starts with a copy in the evolve repository.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 22 Nov 2017 13:44:44 +0100 |
parents | 88f11b9881b2 |
children | 9361149224a7 |
files | hgext3rd/evolve/genericcaches.py |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/genericcaches.py Wed Nov 22 13:40:47 2017 +0100 +++ b/hgext3rd/evolve/genericcaches.py Wed Nov 22 13:44:44 2017 +0100 @@ -91,6 +91,11 @@ """ raise NotImplementedError + @abc.abstractmethod + def _updatesummary(self, data): + """return a small string to be included in debug output""" + raise NotImplementedError + # Useful "public" function (no need to override them) def update(self, repo): @@ -114,8 +119,9 @@ starttime = util.timer() self._updatefrom(repo, data) duration = util.timer() - starttime - repo.ui.log('cache', 'updated %s in %.4f seconds\n', - self._cachename, duration) + summary = self._updatesummary(data) + repo.ui.log('cache', 'updated %s in %.4f seconds (%s)\n', + self._cachename, duration, summary) self._cachekey = newkey @@ -164,3 +170,6 @@ def _fetchupdatedata(self, repo): return self._fetchchangelogdata(self._cachekey, repo.changelog) + + def _updatesummary(self, data): + return '%ir' % len(data)