~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Robert Collins
  • Date: 2005-09-07 10:47:36 UTC
  • mto: (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050907104736-8e592b72108c577d
symlink support updated to work

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
        for path, entry in self.inventory.iter_entries():
147
147
            yield path, 'V', entry.kind, entry.file_id
148
148
 
 
149
    def get_symlink_target(self, file_id):
 
150
        ie = self._inventory[file_id]
 
151
        return ie.symlink_target;
149
152
 
150
153
class EmptyTree(Tree):
151
154
    def __init__(self):
152
155
        self._inventory = Inventory()
153
156
 
 
157
    def get_symlink_target(self, file_id):
 
158
        return None
 
159
 
154
160
    def has_filename(self, filename):
155
161
        return False
156
162
 
260
266
            os.mkdir(fullpath)
261
267
        elif kind == 'file':
262
268
            pumpfile(tree.get_file(ie.file_id), file(fullpath, 'wb'))
 
269
        elif kind == 'symlink':
 
270
            try:
 
271
                os.symlink(ie.symlink_target, fullpath)
 
272
            except OSError,e:
 
273
                raise BzrError("Failed to create symlink %r -> %r, error: %s" % (fullpath, ie.symlink_target, e))
263
274
        else:
264
275
            raise BzrError("don't know how to export {%s} of kind %r" % (ie.file_id, kind))
265
276
        mutter("  export {%s} kind %s to %s" % (ie.file_id, kind, fullpath))