You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Branko Čibej <br...@xbc.nu> on 2005/10/01 00:09:17 UTC
[Patch] Set wc admin dir name in bindings [Was: Fix position of apr_initialize()
in Python bindings]
Max's patch gave me an idea for implementing the svn_wc_set_adm_dir hack
for all bindings libs. Can someone please review this and tell me if I'm
completely insane?
Index: svn_wc.i
===================================================================
--- svn_wc.i (revision 16381)
+++ svn_wc.i (working copy)
@@ -296,3 +296,30 @@
%}
%include svn_wc_h.swg
+
+%init %{
+#ifdef WIN32
+if (getenv ("SVN_ASP_DOT_NET_HACK"))
+{
+#if defined(SWIGPYTHON)
+ static const char set_adm_dir_err_prefix[] = "svn-py: ";
+#elif defined(SWIGPERL)
+ static const char set_adm_dir_err_prefix[] = "svn-pl: ";
+#elif defined(SWIGRUBY)
+ static const char set_adm_dir_err_prefix[] = "svn-rb: ";
+#else
+ static const char set_adm_dir_err_prefix[] = "svn-??: ";
+#endif
+
+ apr_pool_t *pool = svn_pool_create(NULL);
+ svn_error_t *const set_adm_dir_err = svn_wc_set_adm_dir("_svn", pool);
+ svn_pool_destroy(pool);
+ if (set_adm_dir_err)
+ {
+ svn_handle_error2(set_adm_dir_err, stderr, FALSE,
+ set_adm_dir_err_prefix);
+ exit(1);
+ }
+}
+#endif /* WIN32 */
+%}
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [Patch] Set wc admin dir name in bindings [Was: Fix position of apr_initialize() in Python bindings]
Posted by Max Bowsher <ma...@ukf.net>.
Branko Čibej wrote:
> Max Bowsher wrote:
>
>> Branko Čibej wrote:
>>
>>> Max's patch gave me an idea for implementing the svn_wc_set_adm_dir hack
>>> for all bindings libs. Can someone please review this and tell me if I'm
>>> completely insane?
...
>> Unfortunately, if someone does just "import svn.wc", then the wc
>> initfunc runs *before* the core initfunc, so apr is not initialized at
>> this time.
>
> Yes, I figured as much after I posted this patch. Ah, well. It would be
> really nice if we could do something like this for the bindings...
This takes care of it for Python, I think:
[[[
Index: subversion/bindings/swig/svn_wc.i
===================================================================
--- subversion/bindings/swig/svn_wc.i (revision 16385)
+++ subversion/bindings/swig/svn_wc.i (working copy)
@@ -296,3 +296,20 @@
%}
%include svn_wc_h.swg
+
+%inline %{
+svn_error_t *
+svn_swig_init_asp_dot_net_hack (apr_pool_t *pool)
+{
+#ifdef WIN32
+ if (getenv ("SVN_ASP_DOT_NET_HACK"))
+ SVN_ERR (svn_wc_set_adm_dir("_svn", pool));
+#endif /* WIN32 */
+ return SVN_NO_ERROR;
+}
+%}
+
+#if defined(SWIGPYTHON)
+%pythoncode %{ svn_swig_init_asp_dot_net_hack() %}
+#endif
]]]
The other languages will need to invoke svn_swig_init_asp_dot_net_hack()
from their handcoded layers:
* subversion/bindings/swig/perl/native/Wc.pm
* subversion/bindings/swig/ruby/svn/wc.rb
I haven't done that, because I don't know ruby, and the perl file is quite
large, so I would rather let a perl bindings person put it in the section
that makes most sense to them.
Max.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [Patch] Set wc admin dir name in bindings [Was: Fix position
of apr_initialize() in Python bindings]
Posted by Branko Čibej <br...@xbc.nu>.
Max Bowsher wrote:
> Branko Čibej wrote:
>
>> Max's patch gave me an idea for implementing the svn_wc_set_adm_dir hack
>> for all bindings libs. Can someone please review this and tell me if I'm
>> completely insane?
>>
>> Index: svn_wc.i
>> ===================================================================
>> --- svn_wc.i (revision 16381)
>> +++ svn_wc.i (working copy)
>> @@ -296,3 +296,30 @@
>> %}
>>
>> %include svn_wc_h.swg
>> +
>> +%init %{
>> +#ifdef WIN32
>
> ...
>
>> + apr_pool_t *pool = svn_pool_create(NULL);
>
>
> Unfortunately, if someone does just "import svn.wc", then the wc
> initfunc runs *before* the core initfunc, so apr is not initialized at
> this time.
Yes, I figured as much after I posted this patch. Ah, well. It would be
really nice if we could do something like this for the bindings...
-- Brane
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [Patch] Set wc admin dir name in bindings [Was: Fix position of apr_initialize() in Python bindings]
Posted by Max Bowsher <ma...@ukf.net>.
Branko Čibej wrote:
> Max's patch gave me an idea for implementing the svn_wc_set_adm_dir hack
> for all bindings libs. Can someone please review this and tell me if I'm
> completely insane?
>
> Index: svn_wc.i
> ===================================================================
> --- svn_wc.i (revision 16381)
> +++ svn_wc.i (working copy)
> @@ -296,3 +296,30 @@
> %}
>
> %include svn_wc_h.swg
> +
> +%init %{
> +#ifdef WIN32
...
> + apr_pool_t *pool = svn_pool_create(NULL);
Unfortunately, if someone does just "import svn.wc", then the wc initfunc
runs *before* the core initfunc, so apr is not initialized at this time.
Max.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org