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

Re: Get tag (not revision) into C & perl programs

From: Martin Scharrer <mailinglists_at_madmarty.de>
Date: 2006-12-17 14:24:18 CET

Hi,

On Wednesday 13 December 2006 22:50, j.j.green wrote:
> This is OK for C. But I have around 60 perl programs which use the same
> PCRS mechanism:
>
> # The version: $Format: my "\$version = \"$ProjectVersion$\";"$
> my $version = "5.39";

> I'd be most grateful for suggestions
If you just like to have the project version coded as tag, i.e. it's SVN URL
looks like this:
     svn://host/project_name/tags/version5.39/...
(Protocol could vary)
then just do something like this:

Set the svn:keywords property to 'URL' to include the URL and write something
like this into your Perl scripts:

my $version = ( '$URL$' =~ m{/tags/version(.*?)/} && $1 );
or
(my $version = '$URL$') =~ s{.*/tags/version(.*?)/.*}{$1};
or
my $version = ( '$URL$' =~ m{/tags/version(.*?)/} ) ? $1 : undef;

The $URL$ is of course expanded in your Perls script.

Drawbacks:
 - You need a consistant tagging system
 - Works only if you build the checked-out tagged version not a branch or the
trunk

I hope this helps you,
Martin

or some

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sun Dec 17 14:26:23 2006

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

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