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.
--- 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)