Rev 3778: Two fixes for annotate code. in http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/annotate_cleanups

John Arbash Meinel john at arbash-meinel.com
Fri Oct 17 17:14:50 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/annotate_cleanups

------------------------------------------------------------
revno: 3778
revision-id: john at arbash-meinel.com-20081017161420-q7au1ngfvf2rwb4j
parent: pqm at pqm.ubuntu.com-20081014031836-0pn8u98igc7gvtv0
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: annotate_cleanups
timestamp: Fri 2008-10-17 11:14:20 -0500
message:
  Two fixes for annotate code.
  
  Restore the fast path when a branch is not stacked.
  Handle when compression_parent is not the left-hand parent.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-10-14 02:45:17 +0000
+++ b/NEWS	2008-10-17 16:14:20 +0000
@@ -18,6 +18,13 @@
 
   BUG FIXES:
 
+    * Fixes to the ``annotate`` code. The fast-path which re-used the
+      stored deltas was accidentally disabled all the time, instead of
+      only when a branch was stacked. Second, the code would accidentally
+      re-use a delta even if it wasn't against the left-parent, this
+      could only happen if ``bzr reconcile`` decided that the parent
+      ordering was incorrect in the file graph.  (John Arbash Meinel)
+
   DOCUMENTATION:
 
   API CHANGES:

=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2008-10-03 16:14:39 +0000
+++ b/bzrlib/knit.py	2008-10-17 16:14:20 +0000
@@ -2668,6 +2668,7 @@
                 (rev_id, parent_ids, record) = nodes_to_annotate.pop()
                 (index_memo, compression_parent, parents,
                  record_details) = self._all_build_details[rev_id]
+                blocks = None
                 if compression_parent is not None:
                     comp_children = self._compression_children[compression_parent]
                     if rev_id not in comp_children:
@@ -2694,14 +2695,16 @@
                         copy_base_content=(not reuse_content))
                     fulltext = self._add_fulltext_content(rev_id,
                                                           fulltext_content)
-                    blocks = KnitContent.get_line_delta_blocks(delta,
-                            parent_fulltext, fulltext)
+                    if compression_parent == parent_ids[0]:
+                        # the compression_parent is the left parent, so we can
+                        # re-use the delta
+                        blocks = KnitContent.get_line_delta_blocks(delta,
+                                parent_fulltext, fulltext)
                 else:
                     fulltext_content = self._knit._factory.parse_fulltext(
                         record, rev_id)
                     fulltext = self._add_fulltext_content(rev_id,
                         fulltext_content)
-                    blocks = None
                 nodes_to_annotate.extend(
                     self._add_annotation(rev_id, fulltext, parent_ids,
                                      left_matching_blocks=blocks))
@@ -2722,7 +2725,7 @@
 
         :param key: The key to annotate.
         """
-        if True or len(self._knit._fallback_vfs) > 0:
+        if len(self._knit._fallback_vfs) > 0:
             # stacked knits can't use the fast path at present.
             return self._simple_annotate(key)
         records = self._get_build_graph(key)



More information about the bazaar-commits mailing list