Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#6102 closed defect (fixed)

Don't load Subversion pool if Subversion use is disabled

Reported by: djc <manuzhai@…> Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: version control Version: devel
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Currently, the application-level pool for Subversion is loaded upon importing the versioncontrol.svn_fs module; this, it seems, is always done, when at least the Subversion Python bindings are installed.

However, when the versioncontrol subsystem is disabled and/or when another repository_type is used, I don't think a Subversion pool should be initialized whether the Subversion bindings are used or not (even better would be not to import the Subversion bindings at all).

I've created a minimal patch that makes sure the application-level pool will only be initialized if the SubversionConnector component is initialized. I'm not sure it's possible to not import versioncontrol.* when it's disabled; that would probably be better. It would also be better to skip the importing of libsvn at module load time and set has_subversion to False regardless when repository_type is something other than svn. For now, though, my patch fixes the problem I was seeing.

Index: svn_fs.py
===================================================================
--- svn_fs.py   (revision 6044)
+++ svn_fs.py   (working copy)
@@ -239,11 +239,6 @@
                 del self._weakref


-# Initialize application-level pool
-if has_subversion:
-    Pool()
-
-
 class SubversionConnector(Component):

     implements(IRepositoryConnector)
@@ -261,6 +256,9 @@
         """)

     def __init__(self):
+        # Initialize application-level pool
+        if has_subversion:
+            Pool()
         self._version = None

     def get_supported_types(self):

(Caveat: this assumes the SubversionConnector is always loaded before anything else is done with the Subversion bindings. That seems a reasonable assumption, but it may be wrong.)

Attachments (5)

pool-after-component.diff (638 bytes ) - added by djc <manuzhai@…> 17 years ago.
Patch from the top of the tree.
trac-no-import-disabled.diff (2.0 KB ) - added by djc <manuzhai@…> 17 years ago.
Don't import disabled plugin packages
lazy-svn.diff (5.7 KB ) - added by djc <manuzhai@…> 17 years ago.
Import Subversion bindings lazily
lazy-svn.2.diff (5.8 KB ) - added by djc <manuzhai@…> 17 years ago.
Lazily import Subversion bindings (2)
lazy-svn.3.diff (5.8 KB ) - added by djc <manuzhai@…> 17 years ago.
Lazily import Subversion bindings (3)

Download all attachments as: .zip

Change History (8)

by djc <manuzhai@…>, 17 years ago

Attachment: pool-after-component.diff added

Patch from the top of the tree.

by djc <manuzhai@…>, 17 years ago

Don't import disabled plugin packages

comment:1 by djc <manuzhai@…>, 17 years ago

I've just attached another solution that is more general and better, IMO. It prevents any disabled plugin packages to be imported, so that when I specify that trac.versioncontrol.svn_fs is disabled, it will not be imported (solving all sorts of problems that importing the svn bindings brings with it).

A problem with this might be that the plugin will no longer be listed in a list of available plugins (but I'm not sure of that).

comment:2 by anonymous, 17 years ago

(the last approach at least passes all the tests…)

by djc <manuzhai@…>, 17 years ago

Attachment: lazy-svn.diff added

Import Subversion bindings lazily

by djc <manuzhai@…>, 17 years ago

Attachment: lazy-svn.2.diff added

Lazily import Subversion bindings (2)

by djc <manuzhai@…>, 17 years ago

Attachment: lazy-svn.3.diff added

Lazily import Subversion bindings (3)

comment:3 by Christopher Lenz, 17 years ago

Resolution: fixed
Status: newclosed

Patch applied in [6048]. Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.