You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jannis <bt...@yahoo.de> on 2011/11/25 17:06:17 UTC

getting revision number into text file inside the working copy folder

Dear subversion users,


I am trying to automatically get the actual revision number of my subversion repository into a text file inside the subversion project. 

More precisely, I am using subversion to keep track of the changes I do to the code of several R packages. These packages contain a file named "DESCRIPTION" containig (amongst other) the following line:

Version: 0.5.0.1


When I "build" these packages into *tar.gz R packages (by running R CMD build ... ) this version number is automatically used as the number for that R package and can be accessed easily from within R by running sessionInfo() after loading this package.

Now I would like to have the last digit (1 in this case) to resemble my subversion revision number to get a direct reference from within R to the version of the code that was used to compile the package.

I did the following:

1. run the following in the folder where DESCRIPTION is:

svn propset svn:keywords "LastChangedRevision" DESCRIPTION

2. And changed the relevant line in DESCRIPTION to:

Version: 0.5.0.$LastChangedRevision$


This works partially but changes the line in DESCRIPTION to (for example):

Version: 0.5.0.$LastChangedRevision: 28 $

I need, however:

Version: 0.5.0.28


Is there any way to achieve this? In case you have any solution, try to post it understandable to a SVN-newbi :-).


Thanks for your help!
Jannis

Re: getting revision number into text file inside the working copy folder

Posted by Nico Kadel-Garcia <nk...@gmail.com>.
On Fri, Nov 25, 2011 at 2:38 PM, Ryan Schmidt
<su...@ryandesign.com> wrote:
> On Nov 25, 2011, at 10:06, Jannis wrote:
>
>> 2. And changed the relevant line in DESCRIPTION to:
>>
>> Version: 0.5.0.$LastChangedRevision$
>>
>>
>> This works partially but changes the line in DESCRIPTION to (for example):
>>
>> Version: 0.5.0.$LastChangedRevision: 28 $
>>
>> I need, however:
>>
>> Version: 0.5.0.28
>>
>>
>> Is there any way to achieve this? In case you have any solution, try to post it understandable to a SVN-newbi :-).
>
> Write a script that runs at build time that generates the DESCRIPTION file, possibly from a template.
>
> See also:
>
> http://subversion.apache.org/faq.html#version-value-in-source

I updated something like this, based on the older RPM package building
for Subversion, and which I submitted as part of new packaging 1.7.1,
it's in the archives at
http://comments.gmane.org/gmane.comp.version-control.subversion.devel/132223

Re: getting revision number into text file inside the working copy folder

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Nov 25, 2011, at 10:06, Jannis wrote:

> 2. And changed the relevant line in DESCRIPTION to:
> 
> Version: 0.5.0.$LastChangedRevision$
> 
> 
> This works partially but changes the line in DESCRIPTION to (for example):
> 
> Version: 0.5.0.$LastChangedRevision: 28 $
> 
> I need, however:
> 
> Version: 0.5.0.28
> 
> 
> Is there any way to achieve this? In case you have any solution, try to post it understandable to a SVN-newbi :-).

Write a script that runs at build time that generates the DESCRIPTION file, possibly from a template.

See also: 

http://subversion.apache.org/faq.html#version-value-in-source