[Pkg-bazaar-commits] ./bzr/unstable r376: - fix slow invariant check when reading in InventoryEntry objects

Martin Pool mbp at sourcefrog.net
Fri Apr 10 07:43:42 UTC 2009


------------------------------------------------------------
revno: 376
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Thu 2005-05-05 17:57:02 +1000
message:
  - fix slow invariant check when reading in InventoryEntry objects
  - new default value pattern for InventoryEntry objects
modified:
  bzrlib/inventory.py
-------------- next part --------------
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2005-04-15 07:53:59 +0000
+++ b/bzrlib/inventory.py	2005-05-05 07:57:02 +0000
@@ -101,6 +101,9 @@
 
     # TODO: split InventoryEntry into subclasses for files,
     # directories, etc etc.
+
+    text_sha1 = None
+    text_size = None
     
     def __init__(self, file_id, name, kind, parent_id, text_id=None):
         """Create an InventoryEntry
@@ -117,18 +120,14 @@
         Traceback (most recent call last):
         BzrError: ("InventoryEntry name is not a simple filename: 'src/hello.c'", [])
         """
-        
-        if len(splitpath(name)) != 1:
-            bailout('InventoryEntry name is not a simple filename: %r'
-                    % name)
+        if '/' in name or '\\' in name:
+            raise BzrCheckError('InventoryEntry name %r is invalid' % name)
         
         self.file_id = file_id
         self.name = name
         self.kind = kind
         self.text_id = text_id
         self.parent_id = parent_id
-        self.text_sha1 = None
-        self.text_size = None
         if kind == 'directory':
             self.children = {}
         elif kind == 'file':



More information about the Pkg-bazaar-commits mailing list