[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: Andrew Gabriel <Andrew.Gabriel_at_clearswift.com>
Date: 2006-05-12 08:26:56 CEST

Ralf W. Grosse-Kunstleve [mailto:rwgk@yahoo.com] 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

You will probably find this doesn't work.
You may have many branches which are based on old interfaces,
but the repository has only one revision number, so the repository
revision for all of them them will be the same as for branches which use
new interfaces. (Also, before you commit, it will be difficult to know
what the range check number should be, unless there are no other people
checking in to your repository.)

Use more applicable feature test macros, such as:
#ifdef USE_NEW_INTERFACES

-- 
Andrew Gabriel
Clearswift monitors, controls and protects all its messaging traffic in compliance with its corporate email policy using Clearswift products.
Find out more about Clearswift, its solutions and services at http://www.clearswift.com
This communication is confidential and may contain privileged information intended solely for the named addressee(s). It may not be used or disclosed except for the purpose for which it has been sent. If you are not the intended recipient, you must not copy, distribute or take any action in reliance on it. Unless expressly stated, opinions in this message are those of the individual sender and not of Clearswift. If you have received this communication in error, please notify Clearswift by emailing support@clearswift.com quoting the sender and delete the message and any attached documents. Clearswift accepts no liability or responsibility for any onward transmission or use of emails and attachments having left the Clearswift domain.
This footnote confirms that this email message has been swept by MIMEsweeper for Content Security threats, including computer viruses.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri May 12 08:27:59 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.