[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Command line repository root relative URLs

From: Karl Fogel <kfogel_at_red-bean.com>
Date: 2007-10-22 03:02:05 CEST

"Troy Curtis Jr" <troycurtisjr@gmail.com> writes:
> == The Plan ==
> So I plan to put code where my mouth is and add support for repository
> root relative URLs. I will be basing the parsing on Blair's recent
> relative-externals commits, though I am not planning on implementing
> scheme relative, server relative, or general relative URLs (i.e.
> '../').
>
> [...]
>
> Please vote as to whether you like this idea or not, if it's popular
> enough maybe some of the "real" Subversions devs will help me along on
> my quest!

I like the idea! Don't expect it to make it into 1.5 (we shouldn't
delay shipping for this), but 1.6 is intended to be a smaller, lighter
release, and it could well go into 1.6 if it's ready in time.

> My first thought is to put it in the svn_opt_args_to_target_array2()
> function located in subversion/libsvn_subr/opt.c. I can put a check
> for '^/' in right before svn_path_is_url() in line 859. This appears
> to be a very easy place to implement it as it will transparently
> translate '^/.....' URLs to full URLs. However, the problem with that
> location is that I don't have the repository root URL immediately
> available to me. Plus it appears that the function doesn't parse the
> peg revision syntax, even though the previous version did do so. I
> presume this means it was changed for a reason (i.e. the function was
> doing too much).
>
> My next thought is to create a new function taking as an example the
> fact that svn_opt_parse_path() was apparently factored out of
> svn_opt_args_target_array() for a reason. Of course this means I will
> have to touch more files to make sure all the commands call this
> function to support the new syntax.
>
> Or perhaps a successor to svn_opt_args_to_target_array2():
> svn_opt_args_to_target_array3() which has the repository root as an
> optional argument?

First, make a new function that takes exactly the right arguments and
gives you exactly the answer you want, something like:

   /* If @a target uses the "^/" repository-root-relative syntax, then
    * set @a *new to the expansion of @a target based on @a repos_root
    * (allocating @a *new in @a pool); else set @a *new to @a target.
    */
   svn_opt_maybe_expand_to_url(const char **new,
                               const char *target,
                               const char *repos_root,
                               apr_pool_t *pool);

Then see where you'd most like to call the new function, and if those
places don't have everything you need (like repos_root), then upgrade
them to take the extra parameter, and so on, yes.

Best,
-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Oct 22 03:02:15 2007

This is an archived mail posted to the Subversion Dev mailing list.