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

Re: snv:keywords - want current checked out working revision ID

From: Scott Lawrence <slawrence_at_pingtel.com>
Date: 2004-05-07 14:33:11 CEST

On Fri, 2004-05-07 at 06:09, Adrian Oliver wrote:
> I want to be able to put into my code the currently checked out working
> revision ID using a keyword.
> For example, when I perform an svn update, svn checkout or svn commit,
> the last thing it displays is: "Updated to revision 140."
> I would like to put into my code the "140" using a keyword, as it
> provides a means of linking a compiled executable with the svn revision
> used to generate it.
> I accept that if changes are made after the update, checkout or commit
> and are not recommitted, that it would not be telling the whole truth.

In your Makefile, link svn_version.o into your executable, then add:

svn_version.c: FORCE
        echo 'const char* svn_version(void) { return "' > svn_version.c
        svnversion -n . >> svn_version.c
        echo '"; }' >> svn_version.c

a call to svn_version() will return the working copy version string.

Scott Lawrence
Consulting Engineer
Pingtel Corp.   
+1.781.938.5306 x162
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri May 7 14:34:00 2004

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.