Rev 2757: Fix up hash-addressed storage for pack refactoring in http://sourcefrog.net/bzr/pack-hashes

Martin Pool mbp at sourcefrog.net
Fri Sep 21 07:03:18 BST 2007


At http://sourcefrog.net/bzr/pack-hashes

------------------------------------------------------------
revno: 2757
revision-id: mbp at sourcefrog.net-20070921060317-2n2refgcw1mvd6zd
parent: mbp at sourcefrog.net-20070921054222-tqs00ez9s1nk0cta
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: pack-hashes
timestamp: Fri 2007-09-21 16:03:17 +1000
message:
  Fix up hash-addressed storage for pack refactoring
modified:
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2007-09-21 05:42:22 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2007-09-21 06:03:17 +0000
@@ -147,7 +147,7 @@
         for h, t in add_pairs:
             assert len(h) == 40, \
                     "%r doesn't look like a sha1 hash" % h
-            offset, length = self.repo._open_pack_writer.add_bytes_record(t, [])
+            offset, length = self._open_pack_writer.add_bytes_record(t, [])
             key = (h, )
             value = "%d %d" % (offset, length)
             index_updates.append((key, value))
@@ -474,7 +474,7 @@
                 self._remove_pack_by_name(pack_detail[1])
         # record the newly available packs and stop advertising the old
         # packs
-        self.save_pack_names()
+        self._save_pack_names()
         # move the old packs out of the way
         for revision_count, pack_details in pack_operations:
             self._obsolete_packs(pack_details)
@@ -875,7 +875,7 @@
         else:
             return all_index.iter_entries(key_filter)
 
-    def save_pack_names(self):
+    def _save_pack_names(self):
         builder = GraphIndexBuilder()
         for name, sizes in self._names.iteritems():
             builder.add_node((name, ), ' '.join(str(size) for size in sizes))
@@ -927,9 +927,10 @@
         self._open_pack_hash = None
 
     def _commit_write_group(self):
-        data_inserted = (self.repo._revision_store.data_inserted() or
-            self.repo.weave_store.data_inserted() or 
-            self.repo._inv_thunk.data_inserted())
+        data_inserted = (self.repo._revision_store.data_inserted()
+            or self.repo.weave_store.data_inserted()
+            or self.repo._inv_thunk.data_inserted()
+            or self._hash_write_index.key_count() > 0)
         if data_inserted:
             self._open_pack_writer.end()
             new_name = self._open_pack_hash.hexdigest()
@@ -959,7 +960,7 @@
                 new_pack.signature_index_length)
             self.repo._open_pack_tuple = None
             if not self.autopack():
-                self.save_pack_names()
+                self._save_pack_names()
         else:
             # remove the pending upload
             self.repo._upload_transport.delete(self.repo._open_pack_tuple[1])




More information about the bazaar-commits mailing list