[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: Tue, 8 Dec 2009 15:53:05 -0500

> -----Original Message-----
> From: Bob Archer [mailto:Bob.Archer_at_amsi.com]
> Sent: Tuesday, December 08, 2009 1:55 PM
> To: Leyendecker, Robert; users_at_subversion.tigris.org
> Subject: RE: Any simple way to set/get global revision number?
>
> > Subject: Any simple way to set/get global revision number?
> >
> > 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?
>
> No, not that I know of.
>
> > 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?
>
> I think the most common method here is to implement this in a build
> script and use a CI server that builds each check in. I know this is
> what you say this is what you want to avoid.... but I'm not quite sure
> why?
>
> http://subversion.tigris.org/faq.html#version-value-in-source
>
> BOb
>
>

Not all the environments that can compile and run the code have svn installed and sometimes source code is moved around without moving the svn info dirs. I have used scripts to accomplish these things in the past, was hoping for something more elegant in present day.

Creating a new SVN prop on arbitrary my_version.h file that forces this file to be updated (which would cause the embedded revision related keywords in my_version.h to be updated) when any other file is updated would do the trick for my simple case and avoid having to maintain separate scripting, autotools complexity, etc. If this new property were set, operation would be transparent - if you commit foo.c then bar.c (with $Date$, $Revisions$ etc keywords filled in) gets marked to be checked out next update and you have a way to automatically update the version info for the build.

Building this into svn would allow windows and linux clients to offer same functionality - a pretty easy way to manage the svn version number that gets printed when you type foobar --help without relying on client side scripts to parse and build in the needed info.

Anyway, just an idea. I anticipated the answer is probably no and never, but just wanted make sure I wasn't missing something obvious.

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

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-08 21:55:09 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.