Rev 64: The tests pass, but we have at least one bug where creating the first branch in http://bzr.arbash-meinel.com/plugins/history_db

John Arbash Meinel john at arbash-meinel.com
Wed Apr 7 23:01:54 BST 2010


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

------------------------------------------------------------
revno: 64
revision-id: john at arbash-meinel.com-20100407220138-evzhzzk3pq20eoqy
parent: john at arbash-meinel.com-20100407215554-gb92iqfqqucf2475
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: history_db
timestamp: Wed 2010-04-07 17:01:38 -0500
message:
  The tests pass, but we have at least one bug where creating the first branch
  from a revno loaded the whole ancestry.
  Other stuff from trying to import bzrtools shows some slowdowns that need to be addressed.
-------------- next part --------------
=== modified file 'history_db.py'
--- a/history_db.py	2010-04-07 21:55:54 +0000
+++ b/history_db.py	2010-04-07 22:01:38 +0000
@@ -876,9 +876,10 @@
             else:
                 # we need a new branch number. To get this correct, we have to
                 # make sure that the beginning of this branch has been loaded
-                branch_root = parent_revno[:2] + (1,)
-                while branch_root not in self._dotted_to_db_id:
-                    self._step_mainline()
+                if len(parent_revno) > 1:
+                    branch_root = parent_revno[:2] + (1,)
+                    while branch_root not in self._dotted_to_db_id:
+                        self._step_mainline()
                 base_revno = parent_revno[0]
                 branch_count = (
                     self._revno_to_branch_count.get(base_revno, 0) + 1)

=== modified file 'test_importer.py'
--- a/test_importer.py	2010-04-07 21:55:54 +0000
+++ b/test_importer.py	2010-04-07 22:01:38 +0000
@@ -468,16 +468,16 @@
         self.assertEqual(self.D_id, inc_merger._imported_mainline_id)
 
     def test_handles_simple_child(self):
-        ancestry = {'A': (), 'B': ('A',)}
-        b = MockBranch(ancestry, 'A')
+        ancestry = {'A': (), 'B': ('A',), 'C': ('B',), 'D': ('C',)}
+        b = MockBranch(ancestry, 'C')
         importer = history_db.Importer(':memory:', b, incremental=False)
         importer.do_import()
-        importer._update_ancestry('B')
+        importer._update_ancestry('D')
         self.grab_interesting_ids(importer._rev_id_to_db_id)
-        inc_merger = history_db._IncrementalMergeSort(importer, self.B_id)
+        inc_merger = history_db._IncrementalMergeSort(importer, self.D_id)
         inc_merger._find_interesting_ancestry()
         inc_merger._compute_merge_sort()
-        self.assertScheduledStack(inc_merger, [(self.B_id, (2,), False, 0)])
+        self.assertScheduledStack(inc_merger, [(self.D_id, (4,), False, 0)])
 
     def test_handles_multi_roots(self):
         # Graph:



More information about the bazaar-commits mailing list