obshashrange: always check in base cachekey against the recorded one
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 27 Aug 2018 10:20:15 +0200
changeset 4008 3d51dc72d884
parent 4007 d468db69f9a0
child 4009 c58362473bd4
obshashrange: always check in base cachekey against the recorded one Ignoring the check in the none case is just disaster waiting to happens.
hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py	Mon Aug 27 10:16:12 2018 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Mon Aug 27 10:20:15 2018 +0200
@@ -603,17 +603,15 @@
                 con.execute(_newmeta, self._fullcachekey)
         else:
             con = self._con
-            if self._ondiskcachekey is not None:
-                meta = con.execute(_querymeta).fetchone()
-                if meta[1:] != self._ondiskcachekey:
-                    # drifting is currently an issue because this means another
-                    # process might have already added the cache line we are about
-                    # to add. This will confuse sqlite
-                    msg = _('obshashrange cache: skipping write, '
-                            'database drifted under my feet\n')
-                    data = (meta[2], meta[1], self._ondiskcachekey[0], self._ondiskcachekey[1])
-                    repo.ui.warn(msg)
-                    return
+            meta = con.execute(_querymeta).fetchone()
+            if meta[1:] != self._ondiskcachekey:
+                # drifting is currently an issue because this means another
+                # process might have already added the cache line we are about
+                # to add. This will confuse sqlite
+                msg = _('obshashrange cache: skipping write, '
+                        'database drifted under my feet\n')
+                repo.ui.warn(msg)
+                return
         data = ((rangeid[0], rangeid[1], self.get(rangeid)) for rangeid in self._new)
         con.executemany(_updateobshash, data)
         cachekey = self._fullcachekey