Mercurial > hgsubversion
view .hgsigs @ 1550:67b28d657f62
sqliterevmap: break ".hashes()" cycle in a safer way
The `fromsvn()` revset implementation could cause weakref error when using
sqliterevmap like:
File "hgsubversion/util.py", line 357, in <lambda>
return subset.filter(lambda r: tonode(r) in hashes)
File "hgsubversion/maps.py", line 542, in __contains__
return self.get(key) != None
File "hgsubversion/maps.py", line 533, in get
for row in self.revmap._query(
ReferenceError: weakly-referenced object no longer exists
Basically the seemingly harmless assignment could break surprisingly:
# dangerous: `hashes` does not have a reference of `meta.revmap` and may
# become unavailable after `meta`, `revmap` being released by refcount.
hashes = meta.revmap.hashes()
The above syntax is nice to support while avoiding cycles is also nice.
This patch removes `revmap._hashes` so the revmap no longer owns a reference
of a `ReverseRevMap` object so the `ReverseRevMap` object no longer needs to
use weakref for `self.revmap`.
This could actually be caught by `comprehensive/test_sqlite_revmap.py`.
I was not careful enough verifying the "fromsvn()" patch.
author | Jun Wu <quark@fb.com> |
---|---|
date | Thu, 21 Dec 2017 17:39:52 -0800 |
parents | ac40236a06e3 |
children | f44543ffab9b |
line wrap: on
line source
41ff2014d125cfe6eda39a79dc1c7ca9c99bf785 0 iQIcBAABAgAGBQJTY6GOAAoJELnJ3IJKpb3VrTcP/iIvysZP7BMyBW6QfAZMl9vRz06BlOgGIapNFcI2E12yC6j8oADymz2QZCtj21YyyuxIeuPLya5LQ1OoGHsZk/iW700UxUdrUzW3QbKiTfKrNXN915aRE1rYznzetgQc+xqGV4Hk7P5GarAfBcZtCVtc7/Gmo9AMkU1QbLzhwDGMLLUDt1Gsu9Vn3JugVN6O10NqxxGvU18ahVMsy+qyaJBZ5fJUKnBAmwHa3DCP5DRfDNKUaAl7xOK09gvRi6h6dPl8HPrx6tN3wkQ0QRB6kD06yrJejnQ7eM/1fxLNovZ0MZe2+bHMeXWnzGseQsrlvZSi3GWch4xSW+Tqa/pRo0qbbQ8Tq3Hj7J2Ip482nEwzEZZiWcw/1vAIraYkinGuTcw0Kq+IsKh8zBRN5jiy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