[MERGE] delegate graph generation to knits entirely

Robert Collins robertc at robertcollins.net
Thu Jul 19 02:10:33 BST 2007


This avoids always getting the entire graph when we only want a
sub-graph, and delegates sub- graph generation to the underlying knit
which allows it to specialise it.

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- bzrlib/repofmt/knitrepo.py  2007-07-18 06:24:21 +0000
+++ bzrlib/repofmt/knitrepo.py  2007-07-18 07:46:10 +0000
@@ -146,22 +156,13 @@
             return {}
         revision_id = osutils.safe_revision_id(revision_id)
         a_weave = self._get_revision_vf()
-        entire_graph = a_weave.get_graph()
         if revision_id is None:
             return a_weave.get_graph()
-        elif revision_id not in a_weave:
+        entire_graph = a_weave.get_graph()
+        if revision_id not in a_weave:
             raise errors.NoSuchRevision(self, revision_id)
         else:
-            # add what can be reached from revision_id
-            result = {}
-            pending = set([revision_id])
-            while len(pending) > 0:
-                node = pending.pop()
-                result[node] = a_weave.get_parents(node)
-                for revision_id in result[node]:
-                    if revision_id not in result:
-                        pending.add(revision_id)
-            return result
+            return a_weave.get_graph([revision_id])

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070719/526e115d/attachment.pgp 


More information about the bazaar mailing list