You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Sean Spicer <ss...@magic-earth.com> on 2004/07/02 15:05:44 UTC

How to insert global (not last changed) revision number into code?

Okay, I've got another good question (I think):

I'd like to insert the last checked-out revision number (that returned 
by svn status -u) as a string into a piece of code.   So what I'd like 
to do is have

// version.h

const string REVISION_NUMBER = "$GlobalRev$"
const string REVISION_LOCAL="$GlobalLocal$"

Where global rev get's expanded to the latest global revision number 
when I checkout the code.  Also the local is important (whether I'm on 
a trunk or a branch).  So the expanded file might look like:

// version.h

const string REVISION_NUMBER="12452"
const string 
REVISION_LOCAL="/home/sspicer/Project/branches/wxWindows_port

Any ideas on what would be the best way to do this ?

sean

______________________________________________________
Sean Spicer
Volume Interpretation R&D Manager
Landmark Graphics
www.lgc.com

pgp key fingerprint: 8CED 19B7 3A3A BF54 B8E8  FB11 E044 F6B8 1585 9D54
pgp key (ID 15859D54) available at www.keyserver.net & pgpkeys.mit.edu 

Re: How to insert global (not last changed) revision number into code?

Posted by Max Bowsher <ma...@ukf.net>.
Sean Spicer wrote:
> Okay, I've got another good question (I think):
> 
> I'd like to insert the last checked-out revision number (that returned
> by svn status -u) as a string into a piece of code.   So what I'd like
> to do is have
> 
> // version.h
> 
> const string REVISION_NUMBER = "$GlobalRev$"
> const string REVISION_LOCAL="$GlobalLocal$"
> 
> Where global rev get's expanded to the latest global revision number
> when I checkout the code.  Also the local is important (whether I'm on
> a trunk or a branch).  So the expanded file might look like:
> 
> // version.h
> 
> const string REVISION_NUMBER="12452"
> const string
> REVISION_LOCAL="/home/sspicer/Project/branches/wxWindows_port
> 
> Any ideas on what would be the best way to do this ?

Read about "svnversion" in the book.

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How to insert global (not last changed) revision number into code?

Posted by Michael W Thelen <th...@cs.utah.edu>.
* Sean Spicer <ss...@magic-earth.com> [2004-07-02 09:19]:
> I'd like to insert the last checked-out revision number (that returned 
> by svn status -u) as a string into a piece of code.   So what I'd like 
> to do is have

This may be what you want:
http://subversion.tigris.org/project_faq.html#version-value-in-source

-- Mike

-- 
Michael W. Thelen
Never express yourself more clearly than you are able to think.
                -- Niels Bohr