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

Re: what's a "trail url"?

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2003-10-30 03:42:32 CET

Jack Repenning <jrepenning@collab.net> writes:

> Here's the calculation; as you can see, I've had to hard-code the
> trail_url, but nothing else here is explicitly tied to the tree
> topology of the SVN repo:
>
> set -- `svn info .|grep '^URL:'`
> url="$2"
>
> set --
>
> result=0
>
> if expr "$url" : ".*/trunk\$" > /dev/null \
> || expr "$url" : ".*/trunk/.*\$" > /dev/null ; then
> # from trunk; rev number(s) sufficient
> rev=`svnversion . /repos/svn/trunk`
> version=$rev
>
> elif expr "$url" : ".*/tags/.*" > /dev/null ; then
> # from a tag; assume the tag is sufficient
> version="${url##*/tags/}"
> version="${version%%/.*}"
>
> elif expr "$url" : ".*/branches/.*" > /dev/null ; then
> # from a branch: need branch and rev
> version="${url##*/branches/}"
> version="branch:${version%%/.*}"
> rev=`svnversion . /repos/svn/trunk`
> version="$version:rev:$rev"
> else
> echo >&2 "ERROR: Can't parse version from svn info!"
> version="??"
> result=1
> fi
>
> echo "$version"
> return $result

You should remove all the URL logic from your script and simply run
svnversion without an URL argument, it will continue to produce the
same results.

The URL argument is *only* used to check whether the root URL of the
working copy matches the given URL. Since your script extracts the
root URL and then passes it to svnversion the check will succeed.
Switches within the working copy, i.e. not the working copy root, are
detected by comparing an item's URL with it's parent's URL, the URL
given on the command line is irrelevant.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 30 03:43:15 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.