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

Re: Burning svn revision into binaries

From: Jeff Smith <jsmith_at_robotronics.com>
Date: 2007-02-27 18:57:06 CET

On Tuesday 27 February 2007 09:00, Justin Verity wrote:
> I am trying to put the SVN revision # in my binaries
>
> In my Makefile I do this:
>
> SVNDEF := -D'SVN_REV="$(shell svnversion -n .)"'
> CFLAGS = @CFLAGS@ -pipe $(SVNDEF)
>
> And in my user code I do this:
>
> cout << "SVN Revision is " << SVN_REV << endl;
>
> But the output I get is:
>
> "SVN Revision is exported"
>
> Can anyone help?

It's just not practical to expect to use the new rev# in the file that
is being committed. The committed revision is not given a number
until the commit is done, if you edit the file (noting the new rev#)
*after* the new rev# is known, that would be yet another revision,
and therefore would not be the same number!

One solution is that you define your own version numbers, independent
of the internal subversion rev#. I track that by tagging (copy the
files of that rev to--for example: "tags/prj-1.3", which means I've
called that project version 1.3. There are many possible ways to
automate this procedure so that the "1.3" is also in the revised
files of that rev.

On a side note, some reasons both you and subversion should not be
able to assume what rev# will be assigned before committing is:

1. The file is committed by you, therefore subversion must not make
another change to the file to which you have made commitment.

2. If you see that the HEAD rev# in the repository is 12 and assume
that when you commit it will be rev 13, the assumption is incorrect
because another client may have committed between the time you
checked HEAD and the time you commited.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Feb 27 18:58:02 2007

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.