~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/inventory.py

(spiv) Delete some unused private methods on InventoryEntry classes. (Andrew
 Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
228
228
 
229
229
    known_kinds = ('file', 'directory', 'symlink')
230
230
 
231
 
    def _put_in_tar(self, item, tree):
232
 
        """populate item for stashing in a tar, and return the content stream.
233
 
 
234
 
        If no content is available, return None.
235
 
        """
236
 
        raise BzrError("don't know how to export {%s} of kind %r" %
237
 
                       (self.file_id, self.kind))
238
 
 
239
 
    def _put_on_disk(self, fullpath, tree):
240
 
        """Put this entry onto disk at fullpath, from tree tree."""
241
 
        raise BzrError("don't know how to export {%s} of kind %r" % (self.file_id, self.kind))
242
 
 
243
231
    def sorted_children(self):
244
232
        return sorted(self.children.items())
245
233
 
418
406
        """See InventoryEntry.kind_character."""
419
407
        return '/'
420
408
 
421
 
    def _put_in_tar(self, item, tree):
422
 
        """See InventoryEntry._put_in_tar."""
423
 
        item.type = tarfile.DIRTYPE
424
 
        fileobj = None
425
 
        item.name += '/'
426
 
        item.size = 0
427
 
        item.mode = 0755
428
 
        return fileobj
429
 
 
430
 
    def _put_on_disk(self, fullpath, tree):
431
 
        """See InventoryEntry._put_on_disk."""
432
 
        os.mkdir(fullpath)
433
 
 
434
409
 
435
410
class InventoryFile(InventoryEntry):
436
411
    """A file in an inventory."""
497
472
        """See InventoryEntry.kind_character."""
498
473
        return ''
499
474
 
500
 
    def _put_in_tar(self, item, tree):
501
 
        """See InventoryEntry._put_in_tar."""
502
 
        item.type = tarfile.REGTYPE
503
 
        fileobj = tree.get_file(self.file_id)
504
 
        item.size = self.text_size
505
 
        if tree.is_executable(self.file_id):
506
 
            item.mode = 0755
507
 
        else:
508
 
            item.mode = 0644
509
 
        return fileobj
510
 
 
511
 
    def _put_on_disk(self, fullpath, tree):
512
 
        """See InventoryEntry._put_on_disk."""
513
 
        osutils.pumpfile(tree.get_file(self.file_id), file(fullpath, 'wb'))
514
 
        if tree.is_executable(self.file_id):
515
 
            os.chmod(fullpath, 0755)
516
 
 
517
475
    def _read_tree_state(self, path, work_tree):
518
476
        """See InventoryEntry._read_tree_state."""
519
477
        self.text_sha1 = work_tree.get_file_sha1(self.file_id, path=path)
608
566
        """See InventoryEntry.kind_character."""
609
567
        return ''
610
568
 
611
 
    def _put_in_tar(self, item, tree):
612
 
        """See InventoryEntry._put_in_tar."""
613
 
        item.type = tarfile.SYMTYPE
614
 
        fileobj = None
615
 
        item.size = 0
616
 
        item.mode = 0755
617
 
        item.linkname = self.symlink_target
618
 
        return fileobj
619
 
 
620
 
    def _put_on_disk(self, fullpath, tree):
621
 
        """See InventoryEntry._put_on_disk."""
622
 
        try:
623
 
            os.symlink(self.symlink_target, fullpath)
624
 
        except OSError,e:
625
 
            raise BzrError("Failed to create symlink %r -> %r, error: %s" % (fullpath, self.symlink_target, e))
626
 
 
627
569
    def _read_tree_state(self, path, work_tree):
628
570
        """See InventoryEntry._read_tree_state."""
629
571
        self.symlink_target = work_tree.get_symlink_target(self.file_id)