Rev 4720: Have MemoryTransport.tearDown unregister its transport. in http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-unregister-mem-trans

John Arbash Meinel john at arbash-meinel.com
Thu Jan 7 18:08:45 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-unregister-mem-trans

------------------------------------------------------------
revno: 4720
revision-id: john at arbash-meinel.com-20100107180838-ss5orh1acoxfevh3
parent: pqm at pqm.ubuntu.com-20100106184401-mrv30dls621g1zq7
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.4-unregister-mem-trans
timestamp: Thu 2010-01-07 12:08:38 -0600
message:
  Have MemoryTransport.tearDown unregister its transport.
  
  Small improvement, but it does free up a bit of memory, etc when running
  a big test suite. (After running all of per_pack_repository, 84 memory
  server instances are still registered.)
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-10-29 04:19:13 +0000
+++ b/bzrlib/tests/__init__.py	2010-01-07 18:08:38 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by

=== modified file 'bzrlib/transport/memory.py'
--- a/bzrlib/transport/memory.py	2009-07-20 04:26:55 +0000
+++ b/bzrlib/transport/memory.py	2010-01-07 18:08:38 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -27,6 +27,9 @@
 from cStringIO import StringIO
 import warnings
 
+from bzrlib import (
+    urlutils,
+    )
 from bzrlib.errors import (
     FileExists,
     LockError,
@@ -42,8 +45,8 @@
     register_transport,
     Server,
     Transport,
+    unregister_transport,
     )
-import bzrlib.urlutils as urlutils
 
 
 
@@ -315,11 +318,13 @@
             result._files = self._files
             result._locks = self._locks
             return result
-        register_transport(self._scheme, memory_factory)
+        self._memory_factory = memory_factory
+        register_transport(self._scheme, self._memory_factory)
 
     def tearDown(self):
         """See bzrlib.transport.Server.tearDown."""
         # unregister this server
+        unregister_transport(self._scheme, self._memory_factory)
 
     def get_url(self):
         """See bzrlib.transport.Server.get_url."""



More information about the bazaar-commits mailing list