obshashrange: do not search for affected stable range cache is unavailable
Before this changeset we where resetting in all cases, and then looking for
affected ranges. In addition is the stable range were not available, the
functions silently returned no ranges affected.
Now, do one or the other depending of the availability of the stable range
cache. In practice we always do a broad reset because the code detecting
affected changeset is currently buggy.
--- a/hgext3rd/evolve/obsdiscovery.py Thu Aug 16 20:22:19 2018 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py Thu Aug 16 20:49:55 2018 +0200
@@ -436,14 +436,15 @@
repo.ui.log('evoext-cache', 'obshashcache clean - '
'new markers affect %d changeset and cached ranges\n'
% len(affected))
- # XXX the current reset is too strong we could just drop the affected range
con = self._con
if con is not None:
- con.execute(_reset)
-
- ranges = repo.stablerange.contains(repo, affected)
-
- con.executemany(_delete, ranges)
+ # always reset for now, the code detecting affect is buggy so
+ # we need to reset more broadly than we would like.
+ if True or repo.stablerange._con is None:
+ con.execute(_reset)
+ else:
+ ranges = repo.stablerange.contains(repo, affected)
+ con.executemany(_delete, ranges)
# rewarm key revisions
#
--- a/hgext3rd/evolve/stablerangecache.py Thu Aug 16 20:22:19 2018 +0200
+++ b/hgext3rd/evolve/stablerangecache.py Thu Aug 16 20:49:55 2018 +0200
@@ -151,15 +151,15 @@
self._unsavedsubranges = {}
def contains(self, repo, revs):
+ con = self._con
+ assert con is not None
new = set()
known = set()
depth = repo.depthcache.get
for r in revs:
new.add((r, depth(r) - 1))
new.add((r, 0))
- con = self._con
- while new and con is not None:
- new
+ while new:
if len(new) < 300:
sample = new
else: