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

Re: SVN: Head revision number auto update in code files

From: Elias Gerber <eg_at_viscomvisual.com>
Date: Wed, 14 Aug 2013 11:55:50 +0200

On 14.08.2013 08:33, Eilers Stefan wrote:
> Dear Sir or Madam,
> I want to implement the head revision number in my C project at the
> file version.h.
> Unfortunately there is only the codeword $Revision$ to set the last
> revision where the file version.h was changed:
> #define VERSION " FW.Vers. 0.0 $Revision: 146 $\n"
> Is it possible to implement the Keyword $Head$ to always (every
> commit) update the string to the head revision number?
> e.G.:
> #define VERSION " FW.Vers. 0.0 $Head: 153 $\n"
> The problem was detected e.G. here:
> http://hobiger.org/blog/2013/04/18/svn-revision-number-in-c-code-an-impossible-task/

Why do you need the revision in the file commited? I guess you want to
display the version somewhere in the binary program?
We do this by creating a file version.h.template that contains the
$Revision keyword. In a pre-build step we copy the version.h.template to
version.h, then run subwcrev to replace $Revision with the svn-revision
value. Then we start the build-process that uses version.h.
version.h.template is added to svn (but it never changes) while
version.h is ignored in svn, so that we dont run into the same
I dont know if this approach solves your task, just an idea.
Cheers Elias


To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2013-08-14 11:55:59 CEST

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

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