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

RE: Inserting revision numbers in source

From: Kyle George <kgeorge_at_tcpsoft.com>
Date: 2006-10-31 06:12:56 CET

On Mon, 30 Oct 2006, DK wrote:

> In the example (for a GNU Makefile), it shows how to get the value in a C
> program. Unfortunately, I need this value hard coded in the resource file
> (that is why I put the defines as they were since Windows resource files can
> include C Header files), so that the correct build information is included
> in the executable (as seen by looking at the version in the program's
> properties using right-click under Windows Explorer).

You can generate version.h as part of your makefile with a little
scripting using either SubWCRev or sed and svnversion or both. It looks
like you're already doing this. Make (even MSVS make) should be smart
enough to know it needs to regenerate the resource and your executable if
the include file changes.

In my use, I have templates for files (like your version.in) that I
autogen at build time.

> The FAQ also references SubWCRev.exe, just like I did, but that updates the
> user's working copy which becomes out of step to the version in the
> repository and requires everyone who updates the repository to do it on
> their own working copy.

Distributed working copies are "out of step" by design. This is how
copy-modify-merge works. Just because User A commits a change to the
repository doesn't necessarily mean that users B C and D want those
changes right away. In the subversion model, you can't (nor should you)
push a change out to every working copy of your repository.

More importantly, with the possibility of mixed revision working copies
and/or local modifications, any version information in your exe header
isn't necessarily a guarantee that it was built with a pristine copy of
rXXXX. It's up to you to have a build/release policy that enforces
non-mixed update revision, non-locally modified working copies before
doing a build to insure that the version information is in fact accurate.
Ultimately, the point of including the revision number in the exe is to be
able to go back to exactly what was used to compile it at some point in
the future.

> Much better is Subversion did it in the repository at every commit time.

IMHO, make or a build script can do it better. Doesn't Visual Studio have
pre-build commands it can run? That might be a good place for something
like this on windows.

-- 
Kyle George
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Oct 31 06:13:35 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.