~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Robert Collins
  • Date: 2005-09-12 12:42:30 UTC
  • mfrom: (1092.2.9)
  • mto: (1092.2.15)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050912124229-abcadea71750e4ab
revision eq operators

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
 
161
167
    def __contains__(self, file_id):
162
168
        return file_id in self._inventory
163
169
 
 
170
    def get_file_sha1(self, file_id):
 
171
        assert self._inventory[file_id].kind == "root_directory"
 
172
        return None
 
173
 
 
174
 
164
175
 
165
176
 
166
177
######################################################################
255
266
            os.mkdir(fullpath)
256
267
        elif kind == 'file':
257
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))
258
274
        else:
259
275
            raise BzrError("don't know how to export {%s} of kind %r" % (ie.file_id, kind))
260
276
        mutter("  export {%s} kind %s to %s" % (ie.file_id, kind, fullpath))