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

Re: repository revision -> header file?

From: Ryan Schmidt <subversion-2006q2_at_ryandesign.com>
Date: 2006-05-12 13:18:15 CEST

On May 12, 2006, at 00:57, Ralf W. Grosse-Kunstleve wrote:

> I see SVN maintains a global revision number for a repository. I'd
> like to access this revision number via a C or C++ header file, e.g.
>
> myproj/version.h:
>
> #define MYPROJ_REPOSITORY_REVISION $RepositoryRevision$
>
> I.e. each time svn update is run, I'd like to get the same number
> that is printed at the end ("Updated to revision 4548."):
>
> #define MYPROJ_REPOSITORY_REVISION 4548
>
> This would allow me to easily adjust to evolving library code:
>
> #include <myproj/version.h>
> #if MYPROJ_REPOSITORY_REVISION < 4548
> // use old interfaces
> #else
> // use new interfaces
> #endif
>
> Can this somehow be done with SVN?

Yes, assuming you have a build system of some sort (even just a
simply Makefile that you use). It's a FAQ:

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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri May 12 13:19:39 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.