Rev 49: Update to work with the latest bzr-index2 if you uncomment the custom import lines. in http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk

Robert Collins robertc at robertcollins.net
Mon Jul 14 18:44:21 BST 2008


At http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk

------------------------------------------------------------
revno: 49
revision-id: robertc at robertcollins.net-20080714174419-wqgue26g1t2347mh
parent: robertc at robertcollins.net-20080712062611-im40p0nziufimd5c
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Tue 2008-07-15 03:44:19 +1000
message:
  Update to work with the latest bzr-index2 if you uncomment the custom import lines.
modified:
  index.py                       index.py-20080608055509-hnimeek7q8tctkqf-2
=== modified file 'index.py'
--- a/index.py	2008-07-11 12:40:46 +0000
+++ b/index.py	2008-07-14 17:44:19 +0000
@@ -28,8 +28,10 @@
 import bzrlib.config
 from bzrlib.errors import NotBranchError, NoSuchFile, UnknownFormatError
 from bzrlib.index import CombinedGraphIndex, GraphIndex, InMemoryGraphIndex
-#from bzrlib.plugins.index2.btree_index import BTreeGraphIndex as GraphIndex
-#from bzrlib.plugins.index2.repofmt import InMemoryBTree as InMemoryGraphIndex
+#from bzrlib.plugins.index2.btree_index import (
+#    BTreeGraphIndex as GraphIndex,
+#    BTreeBuilder as InMemoryGraphIndex,
+#    )
 from bzrlib.lockdir import LockDir
 from bzrlib.osutils import split_lines
 from bzrlib.pack import ContainerWriter
@@ -898,7 +900,9 @@
             pack.
         """
         if index_bytes is None:
-            index_bytes = index.finish().read()
+            index_file = index.finish()
+            index_bytes = index_file.read()
+            del index_file
         pos, size = writer.add_bytes_record(index_bytes, [(name,)])
         length = len(index_bytes)
         offset = size - length
@@ -975,7 +979,9 @@
         """
         # Upload preparatory to renaming into place.
         # write to disc.
-        index_bytes = self.revision_index.finish().read()
+        index_file = self.revision_index.finish()
+        index_bytes = index_file.read()
+        del index_file
         index_name = md5.new(index_bytes).hexdigest()
         write_stream = upload_transport.open_write_stream(index_name + ".pack")
         writer = ContainerWriter(write_stream.write)
@@ -1114,7 +1120,9 @@
         revision_index = InMemoryGraphIndex(0, 1)
         for revision in revisions:
             revision_index.add_node(revision, '', ())
-        index_bytes = revision_index.finish().read()
+        index_file = revision_index.finish()
+        index_bytes = index_file.read()
+        del index_file
         self.index_name = md5.new(index_bytes).hexdigest()
         self.write_stream = self.transport.open_write_stream(
             self.index_name + ".pack")




More information about the bazaar-commits mailing list