You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Adam Gibson <ag...@ptm.com> on 2004/03/30 16:51:49 UTC

svn:keywords last changed checked out directory revision number

How do most people deal with including a revision number in their apps? 
The svn:keywords Rev will not work since that is specific to that one
file which might not have changed.  The only way it would work for that
purpose is if there was a TopLevelRev svn:keyworks property or something
like that which always indicated the currently checked out top level
directory revision.

Repository Example:

svn/proj1/trunk/
                vers.h
                source.c

If you check out trunk:

svn co svn/proj1/trunk

so that your current working copy looks like this:

trunk/
      vers.h
      source.c

TopLevelRev would always indicate the last changed revision where
something under trunk and below was changed and not the current revision
of the repository where other directory changes could have bumped up the
repository revision number.

I could then set TopLevelRev svn:keywords on vers.h so that the last
changed revision for that checked out directory would always be
indicated in applications that I build.

-- 
Adam Gibson <ag...@ptm.com>


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

Re: svn:keywords last changed checked out directory revision number

Posted by Sean Moss-Pultz <se...@moss-pultz.com>.
On Mar 31, 2004, at 3:19 AM, Adam Gibson wrote:

> It seems the -c argument to svnversion 'svnversion -c .' gives me what 
> I
> want after an update(not the current repository version but the last
> changes on the directory that was checked out assuming I am in the top
> level directory that was checked out when issuing that command).
>
> Thanks for pointing me in the right direction.

I'm trying to do the same thing as you....until now I thought I would 
need to write a complicated script so thanks for the example.

Do you run this command on the server or the working copy? The reason I 
ask is because we have 1 header file that contains software version 
related information and I would love to have this stuff auto-updated 
from the head revision information (ie date, time, number, etc...).

-Sean


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

Re: svn:keywords last changed checked out directory revision number

Posted by Adam Gibson <ag...@ptm.com>.
On Tue, 2004-03-30 at 12:03, John Peacock wrote:
> Adam Gibson wrote:
> 
> > How do most people deal with including a revision number in their apps? 
> 
> For a Unix-like OS, the following will do what you might want:
> 
> 	$ echo -n "#define REVISION " > rev.h
> 	$ svnversion . >> rev.h
> 
> NOTE: you should do `svn up' prior to this, or you might get a mixed revision 
> answer (like 230:231 where the WC was just committed but not yet updated ).
> 
> I say "might want" above because the revision number is not necessarily the 
> correct thing to use in all cases.  If you have a single project repository, the 
> revision number will always reflect changes to that project (conceivably on a 
> branch as well as on the trunk).  However, if you have multiple projects in the 
> same repository, the revision number will increase in relation to work on all 
> projects, so you could conceivably have huge jumps in revision number for a 
> project which changes little.
> 

It seems the -c argument to svnversion 'svnversion -c .' gives me what I
want after an update(not the current repository version but the last
changes on the directory that was checked out assuming I am in the top
level directory that was checked out when issuing that command).

Thanks for pointing me in the right direction.

-- 
Adam Gibson <ag...@ptm.com>


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

Re: svn:keywords last changed checked out directory revision number

Posted by John Peacock <jp...@rowman.com>.
Adam Gibson wrote:

> How do most people deal with including a revision number in their apps? 

For a Unix-like OS, the following will do what you might want:

	$ echo -n "#define REVISION " > rev.h
	$ svnversion . >> rev.h

NOTE: you should do `svn up' prior to this, or you might get a mixed revision 
answer (like 230:231 where the WC was just committed but not yet updated ).

I say "might want" above because the revision number is not necessarily the 
correct thing to use in all cases.  If you have a single project repository, the 
revision number will always reflect changes to that project (conceivably on a 
branch as well as on the trunk).  However, if you have multiple projects in the 
same repository, the revision number will increase in relation to work on all 
projects, so you could conceivably have huge jumps in revision number for a 
project which changes little.

If that is OK for your purposes, then you can use something like the above in 
your Makefile to regenerate the rev.h file for every release.

HTH

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748

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

Re: svn:keywords last changed checked out directory revision number

Posted by Stefan <st...@tigris.org>.
Adam Gibson wrote:
> How do most people deal with including a revision number in their apps? 
> The svn:keywords Rev will not work since that is specific to that one
> file which might not have changed.  The only way it would work for that
> purpose is if there was a TopLevelRev svn:keyworks property or something
> like that which always indicated the currently checked out top level
> directory revision.
[snip]

You can use the svnversion tool to get the highest last-commit revision.

If you're working on windows, you can also use the SubWCRev.exe tool 
TortoiseSVN uses (tortoisesvn.tigris.org/download.html). It takes a file 
(e.g. version.in), checks the working copy for the highest last-commit 
revision and then creates an output file (e.g. version.h) where all 
$WCREV$ strings in the "in" file are replaced with that revision number. 
TortoiseSVN uses this tool so that the last number in the version 
information represents the last-committed revision number.

Stefan


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

Re: svn:keywords last changed checked out directory revision number

Posted by Adam Gibson <ag...@ptm.com>.
On Tue, 2004-03-30 at 11:59, Ben Collins-Sussman wrote:
> On Tue, 2004-03-30 at 10:51, Adam Gibson wrote:
> > How do most people deal with including a revision number in their apps? 
> 
> We have the build system run 'svnversion' on the working copy, and then
> embed the output into a header file or somesuch.  That's exactly why we
> have the 'svnversion' binary.
> 
> Hm, isn't this in our FAQ yet?  Or in the book...?
> 
> 

The FAQ did not seem to mention it and the book has a very short
description for the svnversion program.

Thanks for all the feedback.  The examples and info that everyone gave
was precisely what I was looking for.

-- 
Adam Gibson <ag...@ptm.com>


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

Re: svn:keywords last changed checked out directory revision number

Posted by Ben Collins-Sussman <su...@collab.net>.
On Tue, 2004-03-30 at 10:51, Adam Gibson wrote:
> How do most people deal with including a revision number in their apps? 

We have the build system run 'svnversion' on the working copy, and then
embed the output into a header file or somesuch.  That's exactly why we
have the 'svnversion' binary.

Hm, isn't this in our FAQ yet?  Or in the book...?




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