[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: Jack Repenning <jrepenning_at_collab.net>
Date: 2003-10-30 03:21:00 CET

At 12:47 AM +0100 10/25/03, Philip Martin wrote:
>
>I very rarely run svnversion by hand, I'm not really sure why people
>do. When handling a working copy 'svn status' and 'svn info' are more
>useful to me. Can you describe how you want to use svnversion?

I have a script that:
* (optionally) updates my svn/ source tree
* builds svn (--disable-shared)
* installs the result into /usr/local/svn-XXXX/

I need some way for the script to know XXXX. I have related scripts
that make it easy to run any of the available svn installations, so I
can compare behavior.

Yes, it's true, this script knows the root of the svn tree (don't we
all?). But as more and more of my code comes under svn control, I
expect to do this on more and more trees, taking the product name
from the name of the launch directory.

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

-- 
-==-
Jack Repenning
CollabNet, Inc.
8000 Marina Boulevard, Suite 600
Brisbane, California 94005
o: 650.228.2562
c: 408.835.8090
f: 650.228.2501
---------------------------------------------------------------------
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:21:44 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.