Rev 4421: Change some asserts into raise: calls. in http://bazaar.launchpad.net/~jameinel/bzr/1.16-chk-direct

John Arbash Meinel john at arbash-meinel.com
Mon Jun 8 19:21:39 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.16-chk-direct

------------------------------------------------------------
revno: 4421
revision-id: john at arbash-meinel.com-20090608182135-mxmy7bbhluq9rm7x
parent: john at arbash-meinel.com-20090608181741-qznlkpr8wi6kz8q6
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.16-chk-direct
timestamp: Mon 2009-06-08 13:21:35 -0500
message:
  Change some asserts into raise: calls.
-------------- next part --------------
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py	2009-06-08 18:17:41 +0000
+++ b/bzrlib/chk_map.py	2009-06-08 18:21:35 +0000
@@ -245,7 +245,8 @@
             and maximum_size
             and node._current_size() > maximum_size):
             prefix, node_details = node._split(store)
-            assert len(node_details) != 1
+            if len(node_details) == 1:
+                raise AssertionError('Failed to split using node._split')
             node = InternalNode(prefix, search_key_func=search_key_func)
             node.set_maximum_size(maximum_size)
             node._key_width = key_width

=== modified file 'bzrlib/repofmt/groupcompress_repo.py'
--- a/bzrlib/repofmt/groupcompress_repo.py	2009-06-08 18:15:08 +0000
+++ b/bzrlib/repofmt/groupcompress_repo.py	2009-06-08 18:21:35 +0000
@@ -705,8 +705,13 @@
         id_to_entry_dict = {}
         parent_id_basename_dict = {}
         for old_path, new_path, file_id, entry in delta:
-            assert old_path is None
-            assert new_path is not None
+            if old_path is not None:
+                raise ValueError('Invalid delta, somebody tried to delete %r'
+                                 ' from the NULL_REVISION'
+                                 % ((old_path, file_id),))
+            if new_path is None:
+                raise ValueError('Invalid delta, delta from NULL_REVISION has'
+                                 ' no new_path %r' % (file_id,))
             # file id changes
             if new_path == '':
                 new_inv.root_id = file_id



More information about the bazaar-commits mailing list