Mercurial > hgsubversion
comparison tests/comprehensive/test_rebuildmeta.py @ 1468:b98ff95b5861
maps: disable iterating methods of RevMap
Since __iter__ is disabled in SqliteRevMap, we want to avoid the pattern
iterating RevMap as well. This patch disables all entries to keys, values and
items and makes it possible to bypass the restriction by setting "_allowiter".
Developers looking for a way to iterate the RevMap should add a new method
in RevMap and SqliteRevMap instead.
The rebuildmeta test needs iteration so we enable it explicitly there.
author | Jun Wu <quark@fb.com> |
---|---|
date | Tue, 31 May 2016 18:24:58 +0100 |
parents | 5de6ec1d7310 |
children | 207a0f26f797 |
comparison
equal
deleted
inserted
replaced
1467:53e306a6086b | 1468:b98ff95b5861 |
---|---|
143 # hg 2.8 and earlier | 143 # hg 2.8 and earlier |
144 self.assertEqual(src.branchtags(), dest.branchtags()) | 144 self.assertEqual(src.branchtags(), dest.branchtags()) |
145 srcbi = util.load(os.path.join(src.path, 'svn', 'branch_info')) | 145 srcbi = util.load(os.path.join(src.path, 'svn', 'branch_info')) |
146 destbi = util.load(os.path.join(dest.path, 'svn', 'branch_info')) | 146 destbi = util.load(os.path.join(dest.path, 'svn', 'branch_info')) |
147 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys())) | 147 self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys())) |
148 revkeys = svnmeta.SVNMeta(dest).revmap.keys() | 148 revmap = svnmeta.SVNMeta(dest).revmap |
149 # revmap disables __iter__ intentionally to avoid possible slow code | |
150 # (not using database index in SqliteRevMap) | |
151 # we need to fetch all keys so enable it by setting _allowiter | |
152 revmap._allowiter = True | |
153 revkeys = revmap.keys() | |
149 for branch in destbi: | 154 for branch in destbi: |
150 srcinfo = srcbi[branch] | 155 srcinfo = srcbi[branch] |
151 destinfo = destbi[branch] | 156 destinfo = destbi[branch] |
152 if srcinfo[:2] == (None, 0) or destinfo[:2] == (None, 0): | 157 if srcinfo[:2] == (None, 0) or destinfo[:2] == (None, 0): |
153 self.assertTrue(srcinfo[2] <= destinfo[2], | 158 self.assertTrue(srcinfo[2] <= destinfo[2], |