Mercurial > hgsubversion
view tests/fixtures/dir_removal.svndump @ 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 | 8c7dae2e0f54 |
children |
line wrap: on
line source
SVN-fs-dump-format-version: 2 UUID: 5554378f-55cc-437f-9045-6148f657307d Revision-number: 0 Prop-content-length: 56 Content-length: 56 K 8 svn:date V 27 2017-05-23T11:48:49.399395Z PROPS-END Revision-number: 1 Prop-content-length: 103 Content-length: 103 K 10 svn:author V 8 testuser K 8 svn:date V 27 2017-05-23T11:49:53.974692Z K 7 svn:log V 1 1 PROPS-END Node-path: dir1 Node-kind: dir Node-action: add Prop-content-length: 10 Content-length: 10 PROPS-END Node-path: dir1/1.txt Node-kind: file Node-action: add Text-content-md5: d41d8cd98f00b204e9800998ecf8427e Text-content-sha1: da39a3ee5e6b4b0d3255bfef95601890afd80709 Prop-content-length: 10 Text-content-length: 0 Content-length: 10 PROPS-END Node-path: dir2 Node-kind: dir Node-action: add Prop-content-length: 10 Content-length: 10 PROPS-END Node-path: dir2/2.txt Node-kind: file Node-action: add Text-content-md5: d41d8cd98f00b204e9800998ecf8427e Text-content-sha1: da39a3ee5e6b4b0d3255bfef95601890afd80709 Prop-content-length: 10 Text-content-length: 0 Content-length: 10 PROPS-END Revision-number: 2 Prop-content-length: 103 Content-length: 103 K 10 svn:author V 8 testuser K 8 svn:date V 27 2017-05-23T11:50:14.852941Z K 7 svn:log V 1 2 PROPS-END Node-path: dir1/dir2 Node-kind: dir Node-action: add Node-copyfrom-rev: 1 Node-copyfrom-path: dir2 Node-path: dir2 Node-action: delete