~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

  • Committer: Robert Collins
  • Date: 2005-10-03 01:42:16 UTC
  • Revision ID: robertc@robertcollins.net-20051003014215-ee2990904cc4c7ad
integrate in Gustavos x-bit patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
        (within the parent directory)
54
54
 
55
55
    kind
56
 
        'directory' or 'file'
 
56
        'directory' or 'file' or 'symlink'
57
57
 
58
58
    parent_id
59
59
        file_id of the parent directory, or ROOT_ID
60
60
 
61
61
    revision
62
 
        the revision_id in which this variationo f this file was 
 
62
        the revision_id in which this variation of this file was 
63
63
        introduced.
64
64
 
 
65
    executable
 
66
        Indicates that this file should be executable on systems
 
67
        that support it.
 
68
 
65
69
    text_sha1
66
70
        sha-1 of the text of the file
67
71
        
112
116
    """
113
117
    
114
118
    __slots__ = ['text_sha1', 'text_size', 'file_id', 'name', 'kind',
115
 
                 'text_id', 'parent_id', 'children',
 
119
                 'text_id', 'parent_id', 'children', 'executable', 
116
120
                 'revision', 'symlink_target']
117
121
 
118
122
    def _add_text_to_weave(self, new_lines, parents, weave_store):
137
141
        if '/' in name or '\\' in name:
138
142
            raise BzrCheckError('InventoryEntry name %r is invalid' % name)
139
143
        
 
144
        self.executable = False
140
145
        self.revision = None
141
146
        self.text_sha1 = None
142
147
        self.text_size = None
212
217
    def copy(self):
213
218
        other = InventoryEntry(self.file_id, self.name, self.kind,
214
219
                               self.parent_id)
 
220
        other.executable = self.executable
215
221
        other.text_id = self.text_id
216
222
        other.text_sha1 = self.text_sha1
217
223
        other.text_size = self.text_size
283
289
        if not isinstance(other, InventoryEntry):
284
290
            return NotImplemented
285
291
 
286
 
        return (self.file_id == other.file_id) \
287
 
               and (self.name == other.name) \
288
 
               and (other.symlink_target == self.symlink_target) \
289
 
               and (self.text_sha1 == other.text_sha1) \
290
 
               and (self.text_size == other.text_size) \
291
 
               and (self.text_id == other.text_id) \
292
 
               and (self.parent_id == other.parent_id) \
293
 
               and (self.kind == other.kind) \
294
 
               and (self.revision == other.revision)
 
292
        return ((self.file_id == other.file_id)
 
293
                and (self.name == other.name)
 
294
                and (other.symlink_target == self.symlink_target)
 
295
                and (self.text_sha1 == other.text_sha1)
 
296
                and (self.text_size == other.text_size)
 
297
                and (self.text_id == other.text_id)
 
298
                and (self.parent_id == other.parent_id)
 
299
                and (self.kind == other.kind)
 
300
                and (self.revision == other.revision)
 
301
                and (self.executable == other.executable)
 
302
                )
295
303
 
296
304
    def __ne__(self, other):
297
305
        return not (self == other)
324
332
            self.read_symlink_target(work_tree.abspath(path))
325
333
        if self.kind == 'file':
326
334
            self.text_sha1 = work_tree.get_file_sha1(self.file_id)
 
335
            self.executable = work_tree.is_executable(self.file_id)
327
336
 
328
337
 
329
338
class RootEntry(InventoryEntry):