Rev 3916: Get rid of assertions in groupcompress_repo.py and pack_repo.py. in file:///home/vila/src/bzr/experimental/bbc-cleanups/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Mar 31 17:20:47 BST 2009
At file:///home/vila/src/bzr/experimental/bbc-cleanups/
------------------------------------------------------------
revno: 3916
revision-id: v.ladeuil+lp at free.fr-20090331162047-0ysybpncrnschkdc
parent: v.ladeuil+lp at free.fr-20090331160855-kxqqt9rot95c9iro
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: bbc-cleanups
timestamp: Tue 2009-03-31 18:20:47 +0200
message:
Get rid of assertions in groupcompress_repo.py and pack_repo.py.
-------------- next part --------------
=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py 2009-03-31 10:08:59 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py 2009-03-31 16:20:47 +0000
@@ -175,7 +175,8 @@
reload_func=reload_func)
self._pack_collection = pack_collection
# ATM, We only support this for GCCHK repositories
- assert pack_collection.chk_index is not None
+ if pack_collection.chk_index is None:
+ raise AssertionError('pack_collection.chk_index should not be None')
self._gather_text_refs = False
self._chk_id_roots = []
self._chk_p_id_roots = []
@@ -210,7 +211,8 @@
self._chk_id_roots.append(key)
id_roots_set.add(key)
p_id_map = chk_inv.parent_id_basename_to_file_id
- assert p_id_map is not None
+ if p_id_map is None:
+ raise AssertionError('Parent id -> file_id map not set')
key = p_id_map.key()
if key not in p_id_roots_set:
p_id_roots_set.add(key)
@@ -330,7 +332,8 @@
access = knit._DirectPackAccess(index_to_pack)
if for_write:
# Use new_pack
- assert self.new_pack is not None
+ if self.new_pack is None:
+ raise AssertionError('No new pack has been set')
index = getattr(self.new_pack, index_name)
index_to_pack[index] = self.new_pack.access_tuple()
index.set_optimize(for_size=True)
@@ -720,7 +723,6 @@
raise errors.UnsuspendableWriteGroup(self)
def _reconcile_pack(self, collection, packs, extension, revs, pb):
- # assert revs is None
packer = GCCHKReconcilePacker(collection, packs, extension)
return packer.pack(pb)
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2009-03-31 07:44:14 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2009-03-31 16:20:47 +0000
@@ -2225,7 +2225,8 @@
for index, key, value, refs in revision_nodes:
node = (index, key, value, refs)
index_memo = self.revisions._index._node_to_position(node)
- assert index_memo[0] == index
+ if index_memo[0] != index:
+ raise AssertionError('%r != %r' % (index_memo[0], index))
index_positions.append((index_memo, key[0],
tuple(parent[0] for parent in refs[0])))
pb.update("Reading revision index", 0, 0)
More information about the bazaar-commits
mailing list