diff 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
line wrap: on
line diff
--- a/tests/comprehensive/test_rebuildmeta.py
+++ b/tests/comprehensive/test_rebuildmeta.py
@@ -145,7 +145,12 @@ def _run_assertions(self, name, single, 
     srcbi = util.load(os.path.join(src.path, 'svn', 'branch_info'))
     destbi = util.load(os.path.join(dest.path, 'svn', 'branch_info'))
     self.assertEqual(sorted(srcbi.keys()), sorted(destbi.keys()))
-    revkeys = svnmeta.SVNMeta(dest).revmap.keys()
+    revmap = svnmeta.SVNMeta(dest).revmap
+    # revmap disables __iter__ intentionally to avoid possible slow code
+    # (not using database index in SqliteRevMap)
+    # we need to fetch all keys so enable it by setting _allowiter
+    revmap._allowiter = True
+    revkeys = revmap.keys()
     for branch in destbi:
         srcinfo = srcbi[branch]
         destinfo = destbi[branch]