Rev 3793: Create an __init__ for CHKInventory to ensure mandatory attributes are set. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Wed Dec 3 22:50:26 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 3793
revision-id: robertc at robertcollins.net-20081203225020-lvbgkbi49avjiy1g
parent: john at arbash-meinel.com-20081203164944-7zgn7egr7ouvn76s
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Thu 2008-12-04 09:50:20 +1100
message:
  Create an __init__ for CHKInventory to ensure mandatory attributes are set.
modified:
  bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2008-11-18 19:27:46 +0000
+++ b/bzrlib/inventory.py	2008-12-03 22:50:20 +0000
@@ -1324,6 +1324,10 @@
     to reuse.
     """
 
+    def __init__(self):
+        CommonInventory.__init__(self)
+        self._entry_cache = {}
+
     def _entry_to_bytes(self, entry):
         """Serialise entry as a single bytestring.
 
@@ -1484,7 +1488,6 @@
         if (result.revision_id,) != expected_revision_id:
             raise ValueError("Mismatched revision id and expected: %r, %r" %
                 (result.revision_id, expected_revision_id))
-        result._entry_cache = {}
         return result
 
     @classmethod
@@ -1525,7 +1528,6 @@
         result.id_to_entry.apply_delta(file_id_delta)
         if parent_id_basename_index:
             result.parent_id_basename_to_file_id.apply_delta(parent_id_delta)
-        result._entry_cache = {}
         return result
 
     def _parent_id_basename_key(self, entry):




More information about the bazaar-commits mailing list