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

RE: Any simple way to set/get global revision number?

From: Bob Archer <bob.archer_at_amsi.com>
Date: Wed, 9 Dec 2009 18:06:18 -0500

> Bob Archer <bob.archer_at_amsi.com> wrote on 12/09/2009 05:19:20 PM:
>
> > How about just having some cron job that on every commit it
> modifies
> > your version.h file and commits it assuming version.h wasn't
> > commited with the last commit. This time whenever anyone does an
> > update they will always get an updated version.h. It might get
> you there.
>
> I tried this, but you're always one behind and/or you get in an
> infinite loop:
>
> 1 - modify the file with the current version
> 2 - commit, which bumps the version
> 3 - since the version changed, go back to (1)

But, the version didn't really change. When I do an update version.h will have the rev it was updated in it. Right? I think even if you use svnversion it will put the last rev that file was changed... not the rev number of HEAD, which I think is what it sounds like what you want.

The infinite loop is avoided because you ignore the version.h file. We have several files that our build commits and we have cc.net set to ignore those files in the build triggers.

>
> (Plus, cron isn't portable, nor is svnversion, and it feels like
> a hack for something that would be better integrated into svn
> just as $Id$ is.)

You don't need cron to be portable... you only need the cron job to run on one machine, like your svn server which makes sure that version.h is committed into ever rev... if it is not you immediately commit it. The chance that someone will do a get or update from the rev that did have a commited version.h is pretty slim.

But, $Id$ and $Rev$ work exactly the same way.

BOb

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=2429047

Please start new threads on the <users_at_subversion.apache.org> mailing list.
To subscribe to the new list, send an empty e-mail to <users-subscribe_at_subversion.apache.org>.
Received on 2009-12-10 00:07:24 CET

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.