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

Easy way to embed head version number?.

From: Joe Wade <d.joe.wade_at_gmail.com>
Date: 2005-08-25 22:16:28 CEST

Unfortunately, I don't think this is as simple as using a svn:keywords
Rev property. I have done some serious googling and book reading but
have not yet found an answer.

I have a feeling I am going to need to create a hook to do what I want,
but I am not sure, so any input would be appreciated.

This is what I am trying to do.

I want to embed the head repository version number in the code of a
project so that when the code is compilied the head version number is
embedded in the binary (executable/library/etc). I want to do this, so
when a customer calls me up, I can have them give me the binary version
info and know exactly what code was used to create the binary.

Ideally, I would be able to embed a string such as:

                1.001.1234

where the first two number indicate major and minor revision, and the
last indicates the revision of the repository when the binary was created.

I thought this was going to be a doddle using the svn:keywords property;
however, as the $Rev property describes the last known revision in which
the file changed in the repository. So if there are more than one file
in a project, I cannot put the $Rev$ property in the main library
header, as unless this file is edited every commit the number in this
file does not represent the head version number.

I suppose I could use the $URL$ property and create a tag for every
version, but I prefer having the customer giving me a number rather than
a path into my repository. (Imagine running svn --version and getting
http://my-repos/path/to/bin ...eh).

So I am leaning towards a hook, but I am getting stuck on the
implementation. As only the files that are modified are committed,
running a pre-commit hook would not give me the result I am looking for,
unless I hack some version file that is modified every commit, that
contains the head version number, but the more I think about it, the
less this seems like a good idea.

Has anyone done something similar and are willing to point me in the
right direction?

Cheers
~Joe

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Aug 25 22:17:59 2005

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.