obsrangecache: raise programming error when using an unwarmed cache
This will provide a better experience for developer using this the cache.
--- a/hgext3rd/evolve/obsdiscovery.py Wed May 17 13:27:29 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py Wed May 17 12:27:13 2017 +0200
@@ -441,12 +441,14 @@
del self._con
def get(self, rangeid):
- # revision should be covered by out tiprev
- # XXX should be a programming error
+ # revision should be covered by the tiprev
#
# XXX there are issue with cache warming, we hack around it for now
if not getattr(self, '_updating', False):
- assert rangeid[0] <= self._cachekey[0]
+ if self._cachekey[0] < rangeid[0]:
+ msg = ('using unwarmed obshashrangecache (%s %s)'
+ % (rangeid[0], self._cachekey[0]))
+ raise error.ProgrammingError(msg)
value = self._data.get(rangeid)
if value is None and self._con is not None: