~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Aaron Bentley
  • Date: 2005-10-04 04:32:32 UTC
  • mfrom: (1185.12.6)
  • mto: (1185.12.13)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: aaron.bentley@utoronto.ca-20051004043231-40302a149769263b
merged my own changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
    def get_file_lines(self, file_id):
135
135
        ie = self._inventory[file_id]
136
136
        weave = self.get_weave(file_id)
137
 
        return weave.get(ie.text_version)
 
137
        return weave.get(ie.revision)
138
138
        
139
139
 
140
140
    def get_file_text(self, file_id):
152
152
        if ie.kind == "file":
153
153
            return ie.text_sha1
154
154
 
 
155
    def is_executable(self, file_id):
 
156
        return self._inventory[file_id].executable
 
157
 
155
158
    def has_filename(self, filename):
156
159
        return bool(self.inventory.path2id(filename))
157
160
 
160
163
        for path, entry in self.inventory.iter_entries():
161
164
            yield path, 'V', entry.kind, entry.file_id
162
165
 
 
166
    def get_symlink_target(self, file_id):
 
167
        ie = self._inventory[file_id]
 
168
        return ie.symlink_target;
163
169
 
164
170
class EmptyTree(Tree):
165
171
    def __init__(self):
166
172
        self._inventory = Inventory()
167
173
 
 
174
    def get_symlink_target(self, file_id):
 
175
        return None
 
176
 
168
177
    def has_filename(self, filename):
169
178
        return False
170
179
 
274
283
            os.mkdir(fullpath)
275
284
        elif kind == 'file':
276
285
            pumpfile(tree.get_file(ie.file_id), file(fullpath, 'wb'))
 
286
            if tree.is_executable(ie.file_id):
 
287
                os.chmod(fullpath, 0755)
 
288
        elif kind == 'symlink':
 
289
            try:
 
290
                os.symlink(ie.symlink_target, fullpath)
 
291
            except OSError,e:
 
292
                raise BzrError("Failed to create symlink %r -> %r, error: %s" % (fullpath, ie.symlink_target, e))
277
293
        else:
278
294
            raise BzrError("don't know how to export {%s} of kind %r" % (ie.file_id, kind))
279
295
        mutter("  export {%s} kind %s to %s" % (ie.file_id, kind, fullpath))
339
355
                item.type = tarfile.REGTYPE
340
356
                fileobj = tree.get_file(ie.file_id)
341
357
                item.size = _find_file_size(fileobj)
342
 
                item.mode = 0644
 
358
                if tree.is_executable(ie.file_id):
 
359
                    item.mode = 0755
 
360
                else:
 
361
                    item.mode = 0644
343
362
            else:
344
363
                raise BzrError("don't know how to export {%s} of kind %r" %
345
364
                        (ie.file_id, ie.kind))