# HG changeset patch # User Pierre-Yves David # Date 1511354684 -3600 # Node ID 0c8c7b5274a50636311ccc406e97310b3d6314e7 # Parent 88f11b9881b259a4623f9eafef22ee4c9d7d558a 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. diff -r 88f11b9881b2 -r 0c8c7b5274a5 hgext3rd/evolve/genericcaches.py --- 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)