Rev 56: Now stepping the mainline auto-updates the dotted info caches. in http://bzr.arbash-meinel.com/plugins/history_db

John Arbash Meinel john at arbash-meinel.com
Wed Apr 7 19:42:29 BST 2010


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

------------------------------------------------------------
revno: 56
revision-id: john at arbash-meinel.com-20100407184213-xdxq5toqyk4ri4cq
parent: john at arbash-meinel.com-20100407184004-t3x5mjd1j1qxp4x2
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: history_db
timestamp: Wed 2010-04-07 13:42:13 -0500
message:
  Now stepping the mainline auto-updates the dotted info caches.
-------------- next part --------------
=== modified file 'history_db.py'
--- a/history_db.py	2010-04-07 18:40:04 +0000
+++ b/history_db.py	2010-04-07 18:42:13 +0000
@@ -612,8 +612,7 @@
             [self._imported_mainline_id]).fetchall()
         dotted_info = [(r[0], (tuple(map(int, r[1].split('.'))), r[2], r[3]))
                        for r in res]
-        self._imported_dotted_revno.update(dotted_info)
-        self._dotted_to_db_id.update([(i[1][0], i[0]) for i in dotted_info])
+        self._update_info_from_dotted_revno(dotted_info)
         # TODO: We could remove search tips that show up as newly merged
         #       though that can wait until the next
         #       _split_search_tips_by_gdfo
@@ -714,12 +713,13 @@
         # _imported_dotted_revno
         self._ensure_lh_parent_info()
 
-    def _update_info_from_dotted_revno(self):
+    def _update_info_from_dotted_revno(self, dotted_info):
         """Update info like 'child_seen' from the dotted_revno info."""
         # TODO: We can move this iterator into a parameter, and have it
         #       continuously updated from _step_mainline()
-        iterator = self._imported_dotted_revno.iteritems()
-        for db_id, (revno, eom, depth) in iterator:
+        self._imported_dotted_revno.update(dotted_info)
+        self._dotted_to_db_id.update([(i[1][0], i[0]) for i in dotted_info])
+        for db_id, (revno, eom, depth) in dotted_info:
             if len(revno) > 1: # dotted revno, make sure branch count is right
                 base_revno = revno[0]
                 if (base_revno not in self._revno_to_branch_count
@@ -890,7 +890,6 @@
 
     def do_import(self):
         self._find_interesting_ancestry()
-        self._update_info_from_dotted_revno()
         self._compute_merge_sort()
 
 

=== modified file 'test_importer.py'
--- a/test_importer.py	2010-04-07 18:40:04 +0000
+++ b/test_importer.py	2010-04-07 18:42:13 +0000
@@ -309,7 +309,6 @@
                           self.F_id: ((1,2,2), 0, 1),
                           self.G_id: ((3,), 0, 0),
                          }, inc_importer._imported_dotted_revno)
-        inc_importer._update_info_from_dotted_revno()
         self.assertEqual({1: 2}, inc_importer._revno_to_branch_count)
         self.assertEqual({0: 3, (1, 1): 2, (1, 2): 2},
                          inc_importer._branch_to_child_count)
@@ -409,7 +408,6 @@
         self.grab_interesting_ids(importer._rev_id_to_db_id)
         inc_importer = history_db._IncrementalImporter(importer, self.O_id)
         inc_importer._find_interesting_ancestry()
-        inc_importer._update_info_from_dotted_revno()
         inc_importer._compute_merge_sort()
         self.assertEqual([(self.K_id, (1, 2, 4), True, 1),
                           (self.L_id, (1, 4, 1), True, 2),
@@ -426,7 +424,6 @@
         self.grab_interesting_ids(importer._rev_id_to_db_id)
         inc_importer = history_db._IncrementalImporter(importer, self.B_id)
         inc_importer._find_interesting_ancestry()
-        inc_importer._update_info_from_dotted_revno()
         inc_importer._compute_merge_sort()
         self.assertEqual([(self.B_id, (2,), False, 0),
                          ], inc_importer._scheduled_stack)
@@ -455,7 +452,6 @@
         self.assertEqual(self.C_id, inc_importer._imported_mainline_id)
         self.assertEqual(set([self.E_id, self.F_id]),
                          inc_importer._interesting_ancestor_ids)
-        inc_importer._update_info_from_dotted_revno()
         inc_importer._compute_merge_sort()
         self.assertEqual([(self.E_id, (0, 2, 1), True, 1),
                           (self.F_id, (4,), False, 0),



More information about the bazaar-commits mailing list