Rev 38: assert that the parent table also got filled out properly. in http://bzr.arbash-meinel.com/plugins/history_db

John Arbash Meinel john at arbash-meinel.com
Mon Apr 5 05:00:24 BST 2010


At http://bzr.arbash-meinel.com/plugins/history_db

------------------------------------------------------------
revno: 38
revision-id: john at arbash-meinel.com-20100405040021-n3bv0gdt5itgdfek
parent: john at arbash-meinel.com-20100405035417-bc76gvjqy8xt0yan
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: history_db
timestamp: Sun 2010-04-04 23:00:21 -0500
message:
  assert that the parent table also got filled out properly.
-------------- next part --------------
=== modified file 'test_importer.py'
--- a/test_importer.py	2010-04-05 03:54:17 +0000
+++ b/test_importer.py	2010-04-05 04:00:21 +0000
@@ -164,6 +164,15 @@
         # Track the db_ids that are assigned
         self.assertEqual({'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 3, 'F': 4,
                           'G': 5, 'H': 4, 'I': 6}, rev_gdfo)
+        parent_map = dict(((c_id, p_idx), p_id) for c_id, p_id, p_idx in
+            cur.execute("SELECT c.revision_id, p.revision_id, parent_idx"
+                        "  FROM parent, revision c, revision p"
+                        " WHERE parent.parent = p.db_id"
+                        "   AND parent.child = c.db_id").fetchall())
+        self.assertEqual({('B', 0): 'A', ('C', 0): 'B', ('D', 0): 'A',
+                          ('D', 1): 'C', ('E', 0): 'B', ('F', 0): 'E',
+                          ('G', 0): 'D', ('G', 1): 'F', ('H', 0): 'E',
+                          ('I', 0): 'G', ('I', 1): 'H'}, parent_map)
 
     def test__update_ancestry_partial(self):
         b = self.make_interesting_branch()
@@ -182,3 +191,12 @@
         # Track the db_ids that are assigned
         self.assertEqual({'A': 11, 'B': 12, 'C': 13, 'D': 14, 'E': 13,
                           'F': 14, 'G': 15, 'H': 14, 'I': 16}, rev_gdfo)
+        parent_map = dict(((c_id, p_idx), p_id) for c_id, p_id, p_idx in
+            cur.execute("SELECT c.revision_id, p.revision_id, parent_idx"
+                        "  FROM parent, revision c, revision p"
+                        " WHERE parent.parent = p.db_id"
+                        "   AND parent.child = c.db_id").fetchall())
+        self.assertEqual({('B', 0): 'A', ('C', 0): 'B', ('D', 0): 'A',
+                          ('D', 1): 'C', ('E', 0): 'B', ('F', 0): 'E',
+                          ('G', 0): 'D', ('G', 1): 'F', ('H', 0): 'E',
+                          ('I', 0): 'G', ('I', 1): 'H'}, parent_map)



More information about the bazaar-commits mailing list