Rev 4854: Change some Branch operations from using .get().read() to .get_bytes() in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-close-file-handles

John Arbash Meinel john at arbash-meinel.com
Wed Dec 2 17:50:37 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-close-file-handles

------------------------------------------------------------
revno: 4854
revision-id: john at arbash-meinel.com-20091202175030-3rwmzdhf9xeoasjb
parent: john at arbash-meinel.com-20091202174945-80ack0gu7j8j8mqm
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-close-file-handles
timestamp: Wed 2009-12-02 11:50:30 -0600
message:
  Change some Branch operations from using .get().read() to .get_bytes()
  
  There is no reason to use the former, and it means we leave file-handles around
  waiting for the garbage collector (or an sftp handle, etc.)
-------------- next part --------------
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2009-10-15 02:11:18 +0000
+++ b/bzrlib/branch.py	2009-12-02 17:50:30 +0000
@@ -1440,7 +1440,7 @@
         """Return the format for the branch object in a_bzrdir."""
         try:
             transport = a_bzrdir.get_branch_transport(None)
-            format_string = transport.get("format").read()
+            format_string = transport.get_bytes("format")
             return klass._formats[format_string]
         except errors.NoSuchFile:
             raise errors.NotBranchError(path=transport.base)
@@ -1979,7 +1979,7 @@
     def get_reference(self, a_bzrdir):
         """See BranchFormat.get_reference()."""
         transport = a_bzrdir.get_branch_transport(None)
-        return transport.get('location').read()
+        return transport.get_bytes('location')
 
     def set_reference(self, a_bzrdir, to_branch):
         """See BranchFormat.set_reference()."""



More information about the bazaar-commits mailing list