changeset 4021:bebba5a5c82d stable

obshashrange: always check in base cachekey against the recorded one Ignoring the check in the none case is just disaster waiting to happens.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 27 Aug 2018 10:20:15 +0200
parents 47b00d3b8ea2
children 082b59126099
files hgext3rd/evolve/obsdiscovery.py
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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
@@ -598,17 +598,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