Rev 4512: Enable the new annotator for gc format repos. in http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate
John Arbash Meinel
john at arbash-meinel.com
Thu Jul 2 22:43:20 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate
------------------------------------------------------------
revno: 4512
revision-id: john at arbash-meinel.com-20090702214305-sss4k9xd5shtu99z
parent: john at arbash-meinel.com-20090702211735-rmfim8kjtveledy4
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-rework-annotate
timestamp: Thu 2009-07-02 16:43:05 -0500
message:
Enable the new annotator for gc format repos.
Determine that I was accidentally calling _get_needed_keys 2 times,
which was causing the code to double the reference counts, and thus
never free the desired items.
-------------- next part --------------
=== modified file 'bzrlib/_annotator_py.py'
--- a/bzrlib/_annotator_py.py 2009-06-23 19:58:52 +0000
+++ b/bzrlib/_annotator_py.py 2009-07-02 21:43:05 +0000
@@ -188,7 +188,6 @@
def annotate(self, key):
"""Return annotated fulltext for the given key."""
- keys = self._get_needed_texts(key)
pb = ui.ui_factory.nested_progress_bar()
try:
for text_key, text, num_lines in self._get_needed_texts(key, pb=pb):
=== modified file 'bzrlib/_annotator_pyx.pyx'
--- a/bzrlib/_annotator_pyx.pyx 2009-06-24 20:49:07 +0000
+++ b/bzrlib/_annotator_pyx.pyx 2009-07-02 21:43:05 +0000
@@ -342,7 +342,7 @@
self._annotations_cache[key] = annotations
for parent_key in parent_keys:
num = self._num_needed_children[parent_key]
- num -= 1
+ num = num - 1
if num == 0:
del self._text_cache[parent_key]
del self._annotations_cache[parent_key]
@@ -364,7 +364,6 @@
def annotate(self, key):
"""Return annotated fulltext for the given key."""
- keys = self._get_needed_texts(key)
pb = ui.ui_factory.nested_progress_bar()
try:
for text_key, text, num_lines in self._get_needed_texts(key, pb=pb):
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py 2009-07-01 10:47:37 +0000
+++ b/bzrlib/groupcompress.py 2009-07-02 21:43:05 +0000
@@ -1069,29 +1069,8 @@
def annotate(self, key):
"""See VersionedFiles.annotate."""
- graph = Graph(self)
- parent_map = self.get_parent_map([key])
- if not parent_map:
- raise errors.RevisionNotPresent(key, self)
- if parent_map[key] is not None:
- parent_map = dict((k, v) for k, v in graph.iter_ancestry([key])
- if v is not None)
- keys = parent_map.keys()
- else:
- keys = [key]
- parent_map = {key:()}
- # We used Graph(self) to load the parent_map, but now that we have it,
- # we can just query the parent map directly, so create a KnownGraph
- heads_provider = _mod_graph.KnownGraph(parent_map)
- parent_cache = {}
- reannotate = annotate.reannotate
- for record in self.get_record_stream(keys, 'topological', True):
- key = record.key
- lines = osutils.chunks_to_lines(record.get_bytes_as('chunked'))
- parent_lines = [parent_cache[parent] for parent in parent_map[key]]
- parent_cache[key] = list(
- reannotate(parent_lines, lines, key, None, heads_provider))
- return parent_cache[key]
+ ann = annotate.Annotator(self)
+ return ann.annotate_flat(key)
def check(self, progress_bar=None):
"""See VersionedFiles.check()."""
More information about the bazaar-commits
mailing list