[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: Leyendecker, Robert <Robert.Leyendecker_at_lsi.com>
Date: Wed, 9 Dec 2009 10:51:42 -0500

Thanks very much for the links, it's great to see what other people are doing.

Build scripts and self generating version files are the process I've been using for a while and it works fine as long as your build env is static and controlled by a single entity (cative). Doesn't work so well moving source code minus svn directories to other non-svn environments.

I've written a few ugly client side hacks to get around this and been in a few interesting organizational meetings to figure out workarounds. Given all the options in SVN - the revision issue merits a more flexible and officially sanctioned solution by svn development team. It doesn't seem like an insurmountable problem.

A reasonable proposal is to develop a new svn property to tag a file to always be checked out fresh when any other file is checked out in the directory - that 5th wheel file would have the $Revision$ etc keywords in it and would always pick up the global revision with no external client side script necessary, in other words, no special perl/python/bash/sed/awk/grep/tcl/m4/autotools/AutohotKey/etc (although I like a challenge as much as the next developer :-). I also tried emulating this behavior with externals, but no luck.

Anyway, then you could simply check out and move source code around to other non-svn systems (windows, linux, or other) and still have your embedded versioning in the version.h file.

But - I don't know how the svn source code is structured so maybe this is too difficult to implement. Or maybe this option exists in an admin configuration and I'm just unaware of it?

> -----Original Message-----
> From: Thomas Harold [mailto:thomas-lists_at_nybeta.com]
> Sent: Tuesday, December 08, 2009 10:13 PM
> To: Leyendecker, Robert
> Cc: users_at_subversion.tigris.org
> Subject: Re: Any simple way to set/get global revision number?
>
> On 12/8/2009 2:43 PM, Leyendecker, Robert wrote:
> > Say I have a c file called version.h and in this file is a macro to
> > build a version string using $HeadURL$ and $Revision$. When a user
> runs
> > the program this information is printed into the log file to help
> > isolate problems to specific versions that change on daily basis.
> > Is there a way to set a property so that this version.h file is
> > automatically checked out whenever an update is made to the directory
> > even if the version.h file is not touched? Or conversely, is there a
> way
> > to have it automatically checked in as a changed file whenever a
> commit
> > is done on any other file in the directory?
> > I'm trying to avoid having to manually run/maintain external scripts
> or
> > programs like svnversion to scrape/touch/alter version files and
> force
> > changes since the src files may be ported to different systems and I
> > want the svn info embedded into a single version file.
> > Am I out of luck for an easy solution?
>
> Looks like you need to build the version.h file on the fly as part of
> your build process.
>
> Found a bunch of links on StackOverflow...
>
> http://stackoverflow.com/questions/151299/embedding-svn-revision-
> number-at-compile-time-in-a-windows-app
>
> http://stackoverflow.com/questions/145449/easy-way-to-embed-svn-
> revision-number-in-page-in-php-closed
>
> http://stackoverflow.com/questions/111436/how-can-i-get-the-svn-
> revision-number-in-php

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

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-09 17:05:31 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.