You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2003/01/30 00:53:10 UTC

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

On Mon, Jan 27, 2003 at 06:13:01PM -0600, rooneg@tigris.org wrote:
>...
> +++ trunk/subversion/libsvn_client/switch.c	Mon Jan 27 18:12:38 2003
>...
> @@ -133,7 +134,9 @@
>    /* Get the RA vtable that matches working copy's current URL. */
>    SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
>    SVN_ERR (svn_ra_get_ra_library (&ra_lib, ra_baton, URL, pool));
> -    
> +
> +  SVN_ERR (svn_client_ctx_get_auth_baton (ctx, &auth_baton));

Eek. This code is *inside* libsvn_client. Our typical pattern is that a
structure is opaque outside the library, but completely visible inside the
library. Thus, we don't need to use getters/setters within the library. The
code can simply refer to ctx->auth_baton.

>...
>    else if ((src_is_url) && (! dst_is_url))
> -    SVN_ERR (repos_to_wc_copy (src_path, src_revision, 
> -                               dst_path, optional_adm_access, auth_baton,
> -                               notify_func, notify_baton,
> -                               pool));
> +    {
> +      svn_client_auth_baton_t *auth_baton;
> +
> +      SVN_ERR (svn_client_ctx_get_auth_baton (ctx, &auth_baton));
>  
> +      SVN_ERR (repos_to_wc_copy (src_path, src_revision, 
> +                                 dst_path, optional_adm_access, auth_baton,
> +                                 notify_func, notify_baton,
> +                                 pool));
> +    }

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Greg Stein gs...@lyra.org.
On Wed, Jan 29, 2003 at 08:22:26PM -0500, Garrett Rooney wrote:
 On Wednesday, January 29, 2003, at 07:53 PM, Greg Stein wrote:
...
 i could go either way on this.  keeping it opaque seemed like a 
 reasonable idea so that we could easily add new things to it in the 
 future (post-1.0) while still remaining binary compatability, but 
 realistically, if we're adding new callbacks or something keeping 
 binary compatability might be pointless if we're breaking semantic 
 compatability.
...
  Why the whole error thing? Just return NULL. It could be quite a valid
  approach for the caller to want to check if auth stuff has been 
  installed or
  not. They shouldn't have to deal with error returns.
 
 as i start playing with the notification baton, it is getting more and 
 more annoying having the error return, since having a null notification 
 function/baton is completely valid.  i'm definately leaning towards 
 forgetting about the error and just returning null if there isn't 
 anything set.

Cool.

  Basically, it seems like there is too much engineering around what 
  could
  be a simple structure.
 
 i'm still not sure if it's worth leaving this opaque or not.  is their 
 any advantage in being able to change this later while retaining binary 
 compatability?

You mention binary compatibility here and above. You may have missed a point
that I made: the context would be opaque *outside* of libsvn_client, but
visible *inside*. You don't have to be binary compat for inside things. If
you make a change to the context, then you're upgrading the library, which
means that you're also updating all uses of the non-opaque structure.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Greg Stein <gs...@lyra.org>.
On Wed, Jan 29, 2003 at 08:22:26PM -0500, Garrett Rooney wrote:
> On Wednesday, January 29, 2003, at 07:53 PM, Greg Stein wrote:
>...
> i could go either way on this.  keeping it opaque seemed like a 
> reasonable idea so that we could easily add new things to it in the 
> future (post-1.0) while still remaining binary compatability, but 
> realistically, if we're adding new callbacks or something keeping 
> binary compatability might be pointless if we're breaking semantic 
> compatability.
>...
> > Why the whole error thing? Just return NULL. It could be quite a valid
> > approach for the caller to want to check if auth stuff has been 
> > installed or
> > not. They shouldn't have to deal with error returns.
> 
> as i start playing with the notification baton, it is getting more and 
> more annoying having the error return, since having a null notification 
> function/baton is completely valid.  i'm definately leaning towards 
> forgetting about the error and just returning null if there isn't 
> anything set.

Cool.

> > Basically, it seems like there is too much "engineering" around what 
> > could
> > be a simple structure.
> 
> i'm still not sure if it's worth leaving this opaque or not.  is their 
> any advantage in being able to change this later while retaining binary 
> compatability?

You mention binary compatibility here and above. You may have missed a point
that I made: the context would be opaque *outside* of libsvn_client, but
visible *inside*. You don't have to be binary compat for inside things. If
you make a change to the context, then you're upgrading the library, which
means that you're also updating all uses of the non-opaque structure.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Branko Čibej <br...@xbc.nu>.
Garrett Rooney wrote:

> Branko Čibej wrote:
>
>> Garrett Rooney wrote:
>>
>>  
>>
>>> the only thing i've thought of caching in the context object is
>>> possibly the parsed config files, so we can avoid reparsing them every
>>> time we need a config option.  do people think this is worthwhile?
>>> one issue with this is that we parse the config files in places other
>>> than libsvn_client, so either we'd have to pass the context object
>>> down into other libraries or we'd have to explicitly pass the config
>>> data we got from the context object into the other libraries.
>>>
>>> what do people think?
>>>   
>>
>>
>> Actually, we should parse the config files (or create the svn_config_t's
>> some other way) in the _client_, not in libsvn_client. Our libraries
>> should not parse the config files themselves, ever. It's the client's
>> responsibility to donfigure the libraries, not the other way around.
>>
>
> this makes sense to me.  how about we have something like:
>
> void svn_client_ctx_set_config (svn_client_ctx_t *ctx, svn_config_t
> *config); 

Sounds good; but you need at least two such functions, one for "config"
and one for "servers". there'll be otehrs later on...

> and then pass the context object down wherever we need the config
> information?  this does seem to justify moving the context object out
> of libsvn_client though...  perhaps in libsvn_util?  in any case,
> having the context store config info is on my list of things to do,
> after notification functions and log message functions.


No, I think the context object should stay in libsvn_client; it just
shouldn't be filled in there. Its contents can come from all sorts of
places (the already come from svn_auth, svn_config and IIRC svn_wc, and
that's O.K:).//

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Branko Čibej br...@xbc.nu.
Garrett Rooney wrote:

 Branko Čibej wrote:

 Garrett Rooney wrote:

  

 the only thing i've thought of caching in the context object is
 possibly the parsed config files, so we can avoid reparsing them every
 time we need a config option.  do people think this is worthwhile?
 one issue with this is that we parse the config files in places other
 than libsvn_client, so either we'd have to pass the context object
 down into other libraries or we'd have to explicitly pass the config
 data we got from the context object into the other libraries.

 what do people think?
   


 Actually, we should parse the config files (or create the svn_config_t's
 some other way) in the _client_, not in libsvn_client. Our libraries
 should not parse the config files themselves, ever. It's the client's
 responsibility to donfigure the libraries, not the other way around.


 this makes sense to me.  how about we have something like:

 void svn_client_ctx_set_config (svn_client_ctx_t *ctx, svn_config_t
 *config); 

Sounds good; but you need at least two such functions, one for config
and one for servers. there'll be otehrs later on...

 and then pass the context object down wherever we need the config
 information?  this does seem to justify moving the context object out
 of libsvn_client though...  perhaps in libsvn_util?  in any case,
 having the context store config info is on my list of things to do,
 after notification functions and log message functions.


No, I think the context object should stay in libsvn_client; it just
shouldn't be filled in there. Its contents can come from all sorts of
places (the already come from svn_auth, svn_config and IIRC svn_wc, and
that's O.K:).//

-- 
Brane Čibej   brane@xbc.nu   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Garrett Rooney ro...@electricjellyfish.net.
Branko Čibej wrote:

Garrett Rooney wrote:

  

the only thing i've thought of caching in the context object is
possibly the parsed config files, so we can avoid reparsing them every
time we need a config option.  do people think this is worthwhile? 
one issue with this is that we parse the config files in places other
than libsvn_client, so either we'd have to pass the context object
down into other libraries or we'd have to explicitly pass the config
data we got from the context object into the other libraries.

what do people think?
    


Actually, we should parse the config files (or create the svn_config_t's
some other way) in the _client_, not in libsvn_client. Our libraries
should not parse the config files themselves, ever. It's the client's
responsibility to donfigure the libraries, not the other way around.


this makes sense to me.  how about we have something like:

void svn_client_ctx_set_config (svn_client_ctx_t *ctx, svn_config_t 
*config);

and then pass the context object down wherever we need the config 
information?  this does seem to justify moving the context object out of 
libsvn_client though...  perhaps in libsvn_util?  in any case, having 
the context store config info is on my list of things to do, after 
notification functions and log message functions.

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
Branko Čibej wrote:

>Garrett Rooney wrote:
>
>  
>
>>the only thing i've thought of caching in the context object is
>>possibly the parsed config files, so we can avoid reparsing them every
>>time we need a config option.  do people think this is worthwhile? 
>>one issue with this is that we parse the config files in places other
>>than libsvn_client, so either we'd have to pass the context object
>>down into other libraries or we'd have to explicitly pass the config
>>data we got from the context object into the other libraries.
>>
>>what do people think?
>>    
>>
>
>Actually, we should parse the config files (or create the svn_config_t's
>some other way) in the _client_, not in libsvn_client. Our libraries
>should not parse the config files themselves, ever. It's the client's
>responsibility to donfigure the libraries, not the other way around.
>

this makes sense to me.  how about we have something like:

void svn_client_ctx_set_config (svn_client_ctx_t *ctx, svn_config_t 
*config);

and then pass the context object down wherever we need the config 
information?  this does seem to justify moving the context object out of 
libsvn_client though...  perhaps in libsvn_util?  in any case, having 
the context store config info is on my list of things to do, after 
notification functions and log message functions.

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Branko Čibej br...@xbc.nu.
Garrett Rooney wrote:

 the only thing i've thought of caching in the context object is
 possibly the parsed config files, so we can avoid reparsing them every
 time we need a config option.  do people think this is worthwhile? 
 one issue with this is that we parse the config files in places other
 than libsvn_client, so either we'd have to pass the context object
 down into other libraries or we'd have to explicitly pass the config
 data we got from the context object into the other libraries.

 what do people think?

Actually, we should parse the config files (or create the svn_config_t's
some other way) in the _client_, not in libsvn_client. Our libraries
should not parse the config files themselves, ever. It's the client's
responsibility to donfigure the libraries, not the other way around.

-- 
Brane Čibej   brane@xbc.nu   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Branko Čibej <br...@xbc.nu>.
Garrett Rooney wrote:

> the only thing i've thought of caching in the context object is
> possibly the parsed config files, so we can avoid reparsing them every
> time we need a config option.  do people think this is worthwhile? 
> one issue with this is that we parse the config files in places other
> than libsvn_client, so either we'd have to pass the context object
> down into other libraries or we'd have to explicitly pass the config
> data we got from the context object into the other libraries.
>
> what do people think?

Actually, we should parse the config files (or create the svn_config_t's
some other way) in the _client_, not in libsvn_client. Our libraries
should not parse the config files themselves, ever. It's the client's
responsibility to donfigure the libraries, not the other way around.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Karl Fogel kf...@newton.ch.collab.net.
Philip Martin philip@codematters.co.uk writes:
 I was surprised when the context baton turned up in libsvn_client, I
 always assumed that it would get passed into libsvn_wc, and possibly
 other libraries as well
 
 http://subversion.tigris.org/servlets/ReadMsg?list=devmsgId=210229

Hmmm.  I had thought: we'll have a client_ctx object, and then bits
from that object will get passed individually into libsvn_wc where
necessary.

If that proves to be unwieldy (in the sense of too many arguments to
libsvn_wc functions), we could genericize the ctx object and just pass
it directly, but could we first see if that's necessary?  It would be
nice to keep our interfaces targeted, so people can tell what's being
passed around.

-K


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Philip Martin <ph...@codematters.co.uk> writes:
> I was surprised when the context baton turned up in libsvn_client, I
> always assumed that it would get passed into libsvn_wc, and possibly
> other libraries as well
> 
> http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=210229

Hmmm.  I had thought: we'll have a client_ctx object, and then bits
from that object will get passed individually into libsvn_wc where
necessary.

If that proves to be unwieldy (in the sense of too many arguments to
libsvn_wc functions), we could genericize the ctx object and just pass
it directly, but could we first see if that's necessary?  It would be
nice to keep our interfaces targeted, so people can tell what's being
passed around.

-K


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Philip Martin <ph...@codematters.co.uk>.
Garrett Rooney <ro...@electricjellyfish.net> writes:

> the only thing i've thought of caching in the context object is
> possibly the parsed config files, so we can avoid reparsing them every
> time we need a config option.  do people think this is worthwhile?

That is the example I was thinking of.

> one issue with this is that we parse the config files in places other
> than libsvn_client, so either we'd have to pass the context object
> down into other libraries or we'd have to explicitly pass the config
> data we got from the context object into the other libraries.

I was surprised when the context baton turned up in libsvn_client, I
always assumed that it would get passed into libsvn_wc, and possibly
other libraries as well

http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=210229

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Philip Martin ph...@codematters.co.uk.
Garrett Rooney rooneg@electricjellyfish.net writes:

 the only thing i've thought of caching in the context object is
 possibly the parsed config files, so we can avoid reparsing them every
 time we need a config option.  do people think this is worthwhile?

That is the example I was thinking of.

 one issue with this is that we parse the config files in places other
 than libsvn_client, so either we'd have to pass the context object
 down into other libraries or we'd have to explicitly pass the config
 data we got from the context object into the other libraries.

I was surprised when the context baton turned up in libsvn_client, I
always assumed that it would get passed into libsvn_wc, and possibly
other libraries as well

http://subversion.tigris.org/servlets/ReadMsg?list=devmsgId=210229

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Garrett Rooney <ro...@electricjellyfish.net> writes:
> the only thing i've thought of caching in the context object is
> possibly the parsed config files, so we can avoid reparsing them every
> time we need a config option.  do people think this is worthwhile?
> one issue with this is that we parse the config files in places other
> than libsvn_client, so either we'd have to pass the context object
> down into other libraries or we'd have to explicitly pass the config
> data we got from the context object into the other libraries.
> 
> what do people think?

I think that explicitly passing the config data we got from the
context object into the other libraries was the plan all along,
actually.  But it doesn't have to be done all at once; and we can pass
the cfg object (not the ctx object) itself where appropriate -- that
is, there's a middle ground between the ctx and the specific data, and
that middle ground is a cfg blob :-).


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Karl Fogel kf...@newton.ch.collab.net.
Garrett Rooney rooneg@electricjellyfish.net writes:
 the only thing i've thought of caching in the context object is
 possibly the parsed config files, so we can avoid reparsing them every
 time we need a config option.  do people think this is worthwhile?
 one issue with this is that we parse the config files in places other
 than libsvn_client, so either we'd have to pass the context object
 down into other libraries or we'd have to explicitly pass the config
 data we got from the context object into the other libraries.
 
 what do people think?

I think that explicitly passing the config data we got from the
context object into the other libraries was the plan all along,
actually.  But it doesn't have to be done all at once; and we can pass
the cfg object (not the ctx object) itself where appropriate -- that
is, there's a middle ground between the ctx and the specific data, and
that middle ground is a cfg blob :-).


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Garrett Rooney ro...@electricjellyfish.net.
On Wednesday, January 29, 2003, at 08:50 PM, Philip Martin wrote:

 Garrett Rooney rooneg@electricjellyfish.net writes:

 Eek. This code is *inside* libsvn_client. Our typical pattern is 
 that a
 structure is opaque outside the library, but completely visible
 inside the library. Thus, we don't need to use getters/setters 
 within the
 library. The code can simply refer to ctx-auth_baton.

 i could go either way on this.  keeping it opaque seemed like a
 reasonable idea so that we could easily add new things to it in the
 future (post-1.0) while still remaining binary compatability, but
 realistically, if we're adding new callbacks or something keeping
 binary compatability might be pointless if we're breaking semantic
 compatability.

 Binary compatability isn't really important here, but there is another
 reason why you may want to keep it opaque and that's if anything gets
 cached in the structure.  For example, the svn_wc_adm_access_t access
 baton is opaque to libsvn_wc, it caches the entries file and the
 interface is responsible for maintaining the cache.  Of course the
 structure doesn't have to be opaque for you to do this, but being
 opaque ensures that your caching mechanism cannot easily be bypassed.

the only thing i've thought of caching in the context object is 
possibly the parsed config files, so we can avoid reparsing them every 
time we need a config option.  do people think this is worthwhile?  one 
issue with this is that we parse the config files in places other than 
libsvn_client, so either we'd have to pass the context object down into 
other libraries or we'd have to explicitly pass the config data we got 
from the context object into the other libraries.

what do people think?

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Philip Martin ph...@codematters.co.uk.
Garrett Rooney rooneg@electricjellyfish.net writes:

  Eek. This code is *inside* libsvn_client. Our typical pattern is that a
  structure is opaque outside the library, but completely visible
  inside the library. Thus, we don't need to use getters/setters within the
  library. The code can simply refer to ctx-auth_baton.
 
 i could go either way on this.  keeping it opaque seemed like a
 reasonable idea so that we could easily add new things to it in the
 future (post-1.0) while still remaining binary compatability, but
 realistically, if we're adding new callbacks or something keeping
 binary compatability might be pointless if we're breaking semantic
 compatability.

Binary compatability isn't really important here, but there is another
reason why you may want to keep it opaque and that's if anything gets
cached in the structure.  For example, the svn_wc_adm_access_t access
baton is opaque to libsvn_wc, it caches the entries file and the
interface is responsible for maintaining the cache.  Of course the
structure doesn't have to be opaque for you to do this, but being
opaque ensures that your caching mechanism cannot easily be bypassed.

To be honest svn_wc_adm_access_t doesn't have a particularly good
interface (I have a plan to improve it) but the principle is clear.
Then again, I am really a C++ programmer with all the baggage that
entails...

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Wednesday, January 29, 2003, at 08:50 PM, Philip Martin wrote:

> Garrett Rooney <ro...@electricjellyfish.net> writes:
>
>>> Eek. This code is *inside* libsvn_client. Our typical pattern is 
>>> that a
>>> structure is opaque outside the library, but completely visible
>>> inside the library. Thus, we don't need to use getters/setters 
>>> within the
>>> library. The code can simply refer to ctx->auth_baton.
>>
>> i could go either way on this.  keeping it opaque seemed like a
>> reasonable idea so that we could easily add new things to it in the
>> future (post-1.0) while still remaining binary compatability, but
>> realistically, if we're adding new callbacks or something keeping
>> binary compatability might be pointless if we're breaking semantic
>> compatability.
>
> Binary compatability isn't really important here, but there is another
> reason why you may want to keep it opaque and that's if anything gets
> cached in the structure.  For example, the svn_wc_adm_access_t access
> baton is opaque to libsvn_wc, it caches the entries file and the
> interface is responsible for maintaining the cache.  Of course the
> structure doesn't have to be opaque for you to do this, but being
> opaque ensures that your caching mechanism cannot easily be bypassed.

the only thing i've thought of caching in the context object is 
possibly the parsed config files, so we can avoid reparsing them every 
time we need a config option.  do people think this is worthwhile?  one 
issue with this is that we parse the config files in places other than 
libsvn_client, so either we'd have to pass the context object down into 
other libraries or we'd have to explicitly pass the config data we got 
from the context object into the other libraries.

what do people think?

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Philip Martin <ph...@codematters.co.uk>.
Garrett Rooney <ro...@electricjellyfish.net> writes:

> > Eek. This code is *inside* libsvn_client. Our typical pattern is that a
> > structure is opaque outside the library, but completely visible
> > inside the library. Thus, we don't need to use getters/setters within the
> > library. The code can simply refer to ctx->auth_baton.
> 
> i could go either way on this.  keeping it opaque seemed like a
> reasonable idea so that we could easily add new things to it in the
> future (post-1.0) while still remaining binary compatability, but
> realistically, if we're adding new callbacks or something keeping
> binary compatability might be pointless if we're breaking semantic
> compatability.

Binary compatability isn't really important here, but there is another
reason why you may want to keep it opaque and that's if anything gets
cached in the structure.  For example, the svn_wc_adm_access_t access
baton is opaque to libsvn_wc, it caches the entries file and the
interface is responsible for maintaining the cache.  Of course the
structure doesn't have to be opaque for you to do this, but being
opaque ensures that your caching mechanism cannot easily be bypassed.

To be honest svn_wc_adm_access_t doesn't have a particularly good
interface (I have a plan to improve it) but the principle is clear.
Then again, I am really a C++ programmer with all the baggage that
entails...

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 4621 - in trunk/subversion: include libsvn_client clients/cmdline svnversion

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Wednesday, January 29, 2003, at 07:53 PM, Greg Stein wrote:

> On Mon, Jan 27, 2003 at 06:13:01PM -0600, rooneg@tigris.org wrote:
>> ...
>> +++ trunk/subversion/libsvn_client/switch.c	Mon Jan 27 18:12:38 2003
>> ...
>> @@ -133,7 +134,9 @@
>>    /* Get the RA vtable that matches working copy's current URL. */
>>    SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
>>    SVN_ERR (svn_ra_get_ra_library (&ra_lib, ra_baton, URL, pool));
>> -
>> +
>> +  SVN_ERR (svn_client_ctx_get_auth_baton (ctx, &auth_baton));
>
> Eek. This code is *inside* libsvn_client. Our typical pattern is that a
> structure is opaque outside the library, but completely visible inside 
> the
> library. Thus, we don't need to use getters/setters within the 
> library. The
> code can simply refer to ctx->auth_baton.

i could go either way on this.  keeping it opaque seemed like a 
reasonable idea so that we could easily add new things to it in the 
future (post-1.0) while still remaining binary compatability, but 
realistically, if we're adding new callbacks or something keeping 
binary compatability might be pointless if we're breaking semantic 
compatability.

>> ...
>>    else if ((src_is_url) && (! dst_is_url))
>> -    SVN_ERR (repos_to_wc_copy (src_path, src_revision,
>> -                               dst_path, optional_adm_access, 
>> auth_baton,
>> -                               notify_func, notify_baton,
>> -                               pool));
>> +    {
>> +      svn_client_auth_baton_t *auth_baton;
>> +
>> +      SVN_ERR (svn_client_ctx_get_auth_baton (ctx, &auth_baton));
>>
>> +      SVN_ERR (repos_to_wc_copy (src_path, src_revision,
>> +                                 dst_path, optional_adm_access, 
>> auth_baton,
>> +                                 notify_func, notify_baton,
>> +                                 pool));
>> +    }
>
>> From a simple line to a big block. Keeping the structure visible 
>> within the
> library would avoid this kind of stuff.
>> ...
>> +++ trunk/subversion/libsvn_client/context.c	Mon Jan 27 18:12:46 2003
>> ...
>> +svn_error_t *
>> +svn_client_ctx_get_auth_baton (svn_client_ctx_t *ctx,
>> +                               svn_client_auth_baton_t **auth_baton)
>> +{
>> +  *auth_baton = ctx->auth_baton;
>> +
>> +  if (! *auth_baton)
>> +    return svn_error_create (SVN_ERR_CLIENT_CTX_NOT_FOUND, NULL,
>> +                             "no authentication baton found");
>
> Why the whole error thing? Just return NULL. It could be quite a valid
> approach for the caller to want to check if auth stuff has been 
> installed or
> not. They shouldn't have to deal with error returns.

as i start playing with the notification baton, it is getting more and 
more annoying having the error return, since having a null notification 
function/baton is completely valid.  i'm definately leaning towards 
forgetting about the error and just returning null if there isn't 
anything set.

> Basically, it seems like there is too much "engineering" around what 
> could
> be a simple structure.

i'm still not sure if it's worth leaving this opaque or not.  is their 
any advantage in being able to change this later while retaining binary 
compatability?

-garrett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org