[MERGE] Redo annotate more simply, using just the public interfaces for VersionedFiles.

Martin Pool mbp at canonical.com
Mon Jul 7 08:59:55 BST 2008


I added this additional patch to make test_annotate pass in the
"named-nograph-knit-pack) case, where get_parents returns None as the
parents of all requested revisions.

This patch is not quite satisfactory because it seems like a bit of a
hack when the code is not being clear about just what should be
expected in these values.  Feedback would be very welcome.


=== modified file 'bzrlib/graph.py'
--- bzrlib/graph.py	2008-05-29 20:17:37 +0000
+++ bzrlib/graph.py	2008-07-07 07:06:46 +0000
@@ -1228,6 +1228,8 @@
         parent_map = self._parents_provider.get_parent_map(revisions)
         found_revisions.update(parent_map)
         for rev_id, parents in parent_map.iteritems():
+            if parents is None:
+                continue
             new_found_parents = [p for p in parents if p not in self.seen]
             if new_found_parents:
                 # Calling set.update() with an empty generator is actually

=== modified file 'bzrlib/knit.py'
--- bzrlib/knit.py	2008-07-04 04:32:12 +0000
+++ bzrlib/knit.py	2008-07-07 07:26:08 +0000
@@ -2714,10 +2714,17 @@
         for record in self._knit.get_record_stream(keys, 'topological', True):
             key = record.key
             fulltext = split_lines(record.get_bytes_as('fulltext'))
-            parent_lines = [parent_cache[parent] for parent in parent_map[key]]
+            parents = parent_map[key]
+            if parents is not None:
+                parent_lines = [parent_cache[parent] for parent in
parent_map[key]]
+            else:
+                parent_lines = []
             parent_cache[key] = list(
                 reannotate(parent_lines, fulltext, key, None, head_cache))
-        return parent_cache[key]
+        try:
+            return parent_cache[key]
+        except KeyError, e:
+            raise errors.RevisionNotPresent(key, self._knit)


 try:



More information about the bazaar mailing list