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

RE: Adding current svn revision to source automatically

From: Daniel Becroft <Daniel.Becroft_at_supercorp.com.au>
Date: Wed, 17 Dec 2008 09:59:36 +1000

> -----Original Message-----
> From: Simon Lucy [mailto:simon.lucy_at_objective2k.com]
> Sent: Tuesday, December 16, 2008 7:44 PM
> To: Kenneth Goldman
> Cc: users_at_subversion.tigris.org
> Subject: Re: Adding current svn revision to source automatically
>
> Kenneth Goldman wrote:
> >
> > "Andy Levy" <andy.levy_at_gmail.com> wrote on 12/15/2008 02:15:27 PM:
> >
> > > On Mon, Dec 15, 2008 at 09:51, Kenneth Goldman
> <kgoldman_at_us.ibm.com>
> > wrote:
> > > > I'd like to have svn add the current version of a directory to
> > > > some C source code, something like
> > > >
> > > > #DEFINE PROGRAM_VERSION 1234
> > > >
> > > > or
> > > >
> > > > const unsigned long program_version = 1234;
> > > >
> > > > Is there a way to do that? Googling came up with two not quite
> > > > right
> > > > alternatives:
> > > >
> > > > - svn itself can add the current version of the file to
> the file,
> > > > but that only works if I change the file every time.
> > > >
> > > > - svnversion utility can return the global version, and the
> > > > makefile can add it in during the compile, but it won't
> appear in the source.
> > > > Builder who just get the source and not svn repository access
> > > > can't run svnversion, can they?
> > > >
> > > > Is there a standard way to do this? Is there a better forum?
> > >
> > > If there's a "more accepted" method of doing it than the FAQ
> > > indicates, then the FAQ needs to be updated.
> > >
> > > http://subversion.tigris.org/faq.html#version-value-in-source
> >
> > This 'FAQ answer' requires use of the svnversion command at
> build time.
> >
> > As I tried to explain above, this requires access to the
> svn repository
> > at build time, right? The version never appears in the
> source, right?
> > So If I create a source tarball and send it to someone, they can't
> > build binaries.
> >
> > I think I need the global version applied to the file at
> commit, not
> > at build, but I don't understand how to do that. However, it seems
> > like such a common need that there must be a solution.
> >
> Do it indirectly, use svnversion to create the revision
> within a file and then as part of the build insert the
> contents of that file (or #include it) where you need it.
>
> Simon

I'm still hoping for a "CheckoutRev" or "ExportRev" keyword to be added
to SVN, that is expanded upon checkout and export.

I would attempt to implement it myself, but unfortunately do not have
the resources at the moment.

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2008-12-17 01:01:03 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.