~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Martin Pool
  • Date: 2005-05-05 07:57:02 UTC
  • Revision ID: mbp@sourcefrog.net-20050505075702-b3c43fe03124f348
- fix slow invariant check when reading in InventoryEntry objects
- new default value pattern for InventoryEntry objects

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
 
102
102
    # TODO: split InventoryEntry into subclasses for files,
103
103
    # directories, etc etc.
 
104
 
 
105
    text_sha1 = None
 
106
    text_size = None
104
107
    
105
108
    def __init__(self, file_id, name, kind, parent_id, text_id=None):
106
109
        """Create an InventoryEntry
117
120
        Traceback (most recent call last):
118
121
        BzrError: ("InventoryEntry name is not a simple filename: 'src/hello.c'", [])
119
122
        """
120
 
        
121
 
        if len(splitpath(name)) != 1:
122
 
            bailout('InventoryEntry name is not a simple filename: %r'
123
 
                    % name)
 
123
        if '/' in name or '\\' in name:
 
124
            raise BzrCheckError('InventoryEntry name %r is invalid' % name)
124
125
        
125
126
        self.file_id = file_id
126
127
        self.name = name
127
128
        self.kind = kind
128
129
        self.text_id = text_id
129
130
        self.parent_id = parent_id
130
 
        self.text_sha1 = None
131
 
        self.text_size = None
132
131
        if kind == 'directory':
133
132
            self.children = {}
134
133
        elif kind == 'file':