You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Stewart Johnson <st...@fatcaterpillar.org> on 2004/04/26 17:15:18 UTC

version label in my source

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi All -

I'd like to be able to put tag information in my source files, but I'm not 
sure how to do it. If I create a tag for my project:

$ svn copy http://example.com/repos/myproj/trunk \
           http://example.com/repos/myproj/tags/REL-0.1.0 \
      -m "Release 0.1.0: snapshot build for the subsystem test team"

... then is it possible to get that release information into my source files? 
ie: I'd like "REL-0.1.0" to appear in the header of my sources, and 
preferably also the commit comment to be there too. Is this possible, or am I 
going about this the wrong way?

I've been wrestling with this for a couple of days now, and not getting 
anywhere. Any help appreciated!

Stewart.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAjUOmBGGH+7lrhRgRAhTfAJ4oZm7wy/yLQQ80opm2CgA7MlAhSgCgiNSy
FpVgpmj22PGBABWEUYw5x8Q=
=b4Sm
-----END PGP SIGNATURE-----

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


Re: version label in my source

Posted by Helge Jensen <je...@slog.dk>.

John Peacock wrote:

> Stewart Johnson wrote:
> 
>> I'd like to be able to put tag information in my source files, but I'm 
>> not sure how to do it. If I create a tag for my project:
>>
>> $ svn copy http://example.com/repos/myproj/trunk \
>>            http://example.com/repos/myproj/tags/REL-0.1.0 \
>>       -m "Release 0.1.0: snapshot build for the subsystem test team"
>>
>> ... then is it possible to get that release information into my source 
>> files? ie: I'd like "REL-0.1.0" to appear in the header of my sources, 

I currently use a program that parses the output of "svnversion", "svn 
info" and "svn status" to generate a source-file that includes this 
information, and then include that source in my program.

If you use "make", this is pretty easy, and with MSDEV, you can put it 
as a pre-build step.

Running the svn programs are "local" and doesn't take long, but you 
probably do not want to update the output file if it hasn't changed.

My program is written in C#, and generates C# code, email me if wish to 
get any of it. (It has a nice GUI, that allows you to Drag&Drop 
assemblies with embedded information onto it, and see all the info 
stored in the assembly)

-- 
Helge

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

Re: version label in my source

Posted by John Peacock <jp...@rowman.com>.
Stewart Johnson wrote:
> I'd like to be able to put tag information in my source files, but I'm not 
> sure how to do it. If I create a tag for my project:
> 
> $ svn copy http://example.com/repos/myproj/trunk \
>            http://example.com/repos/myproj/tags/REL-0.1.0 \
>       -m "Release 0.1.0: snapshot build for the subsystem test team"
> 
> ... then is it possible to get that release information into my source files? 
> ie: I'd like "REL-0.1.0" to appear in the header of my sources, and 
> preferably also the commit comment to be there too. Is this possible, or am I 
> going about this the wrong way?

Currently, the only keyword which comes close to what you want is $HeadURL$, 
which would look like

	$HeadURL: http://example.com/repos/myproj/tags/REL-0.1.0 $

when expanded for the example you list above.  Depending on what kind of source 
files you are talking about, it may be easier or harder to extract the portion 
of that tag that you want.

There is currently no way to get the commit comment into a source file, short of

	svn log filename > filename.log

and then parsing the log file.

There is a couple of outstanding patches on the dev list (by yours truly ;) 
which would change the way that keywords are handled internally, and set the 
stage for localized keywords.  But they are not a short-term solution.

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747

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