Opened 17 years ago
Closed 17 years ago
#6102 closed defect (fixed)
Don't load Subversion pool if Subversion use is disabled
Reported by: | 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)
Change History (8)
by , 17 years ago
Attachment: | pool-after-component.diff added |
---|
by , 17 years ago
Attachment: | trac-no-import-disabled.diff added |
---|
Don't import disabled plugin packages
comment:1 by , 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:3 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch applied in [6048]. Thanks!
Patch from the top of the tree.