Rev 5375: (spiv) Delete some unused private methods on InventoryEntry classes. (Andrew in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Aug 10 02:16:17 BST 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5375 [merge]
revision-id: pqm at pqm.ubuntu.com-20100810011615-0dm93d6fa4mxov6o
parent: pqm at pqm.ubuntu.com-20100807214836-umokeeg6d1dytzvm
parent: andrew.bennetts at canonical.com-20100809101333-5rb3p00b9mi0eilu
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2010-08-10 02:16:15 +0100
message:
  (spiv) Delete some unused private methods on InventoryEntry classes. (Andrew
   Bennetts)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
=== modified file 'NEWS'
--- a/NEWS	2010-08-06 19:54:45 +0000
+++ b/NEWS	2010-08-09 10:13:33 +0000
@@ -103,6 +103,9 @@
   valid for kind == link); and ``reference_revision`` (only valid for kind
   == tree-reference).  (Andrew Bennetts)
 
+* InventoryEntry objects no longer have ``_put_in_tar`` or
+  ``_put_on_disk`` methods.  (Andrew Bennetts)
+
 Internals
 *********
 

=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2010-08-03 13:31:06 +0000
+++ b/bzrlib/inventory.py	2010-08-09 10:13:33 +0000
@@ -228,18 +228,6 @@
 
     known_kinds = ('file', 'directory', 'symlink')
 
-    def _put_in_tar(self, item, tree):
-        """populate item for stashing in a tar, and return the content stream.
-
-        If no content is available, return None.
-        """
-        raise BzrError("don't know how to export {%s} of kind %r" %
-                       (self.file_id, self.kind))
-
-    def _put_on_disk(self, fullpath, tree):
-        """Put this entry onto disk at fullpath, from tree tree."""
-        raise BzrError("don't know how to export {%s} of kind %r" % (self.file_id, self.kind))
-
     def sorted_children(self):
         return sorted(self.children.items())
 
@@ -418,19 +406,6 @@
         """See InventoryEntry.kind_character."""
         return '/'
 
-    def _put_in_tar(self, item, tree):
-        """See InventoryEntry._put_in_tar."""
-        item.type = tarfile.DIRTYPE
-        fileobj = None
-        item.name += '/'
-        item.size = 0
-        item.mode = 0755
-        return fileobj
-
-    def _put_on_disk(self, fullpath, tree):
-        """See InventoryEntry._put_on_disk."""
-        os.mkdir(fullpath)
-
 
 class InventoryFile(InventoryEntry):
     """A file in an inventory."""
@@ -497,23 +472,6 @@
         """See InventoryEntry.kind_character."""
         return ''
 
-    def _put_in_tar(self, item, tree):
-        """See InventoryEntry._put_in_tar."""
-        item.type = tarfile.REGTYPE
-        fileobj = tree.get_file(self.file_id)
-        item.size = self.text_size
-        if tree.is_executable(self.file_id):
-            item.mode = 0755
-        else:
-            item.mode = 0644
-        return fileobj
-
-    def _put_on_disk(self, fullpath, tree):
-        """See InventoryEntry._put_on_disk."""
-        osutils.pumpfile(tree.get_file(self.file_id), file(fullpath, 'wb'))
-        if tree.is_executable(self.file_id):
-            os.chmod(fullpath, 0755)
-
     def _read_tree_state(self, path, work_tree):
         """See InventoryEntry._read_tree_state."""
         self.text_sha1 = work_tree.get_file_sha1(self.file_id, path=path)
@@ -608,22 +566,6 @@
         """See InventoryEntry.kind_character."""
         return ''
 
-    def _put_in_tar(self, item, tree):
-        """See InventoryEntry._put_in_tar."""
-        item.type = tarfile.SYMTYPE
-        fileobj = None
-        item.size = 0
-        item.mode = 0755
-        item.linkname = self.symlink_target
-        return fileobj
-
-    def _put_on_disk(self, fullpath, tree):
-        """See InventoryEntry._put_on_disk."""
-        try:
-            os.symlink(self.symlink_target, fullpath)
-        except OSError,e:
-            raise BzrError("Failed to create symlink %r -> %r, error: %s" % (fullpath, self.symlink_target, e))
-
     def _read_tree_state(self, path, work_tree):
         """See InventoryEntry._read_tree_state."""
         self.symlink_target = work_tree.get_symlink_target(self.file_id)




More information about the bazaar-commits mailing list