how can I have eclipse auto insert subversion revision number into my code
Asked Answered
O

2

8

I'm interested in displaying the version number of my code in a help page. Ideally I'd use a Major.Minor.SVNrevision format, where the SVNrevision number was pulled automatically. I hope? Suspect there's a variable I can access somewhere, but have no idea what it may be.

Any hints?

Orangeism answered 19/8, 2010 at 5:0 Comment(0)
S
5

You can do this by adding so-called SVN Keywords into your working files. This chapter contains standard SVN keywords. Then you have two options:

  1. set property for each folder svn:keywords to make this substitution available for all who works with this repository: svn propset svn:keywords "Date Author Revision" help.html

  2. modify svn configuration file (on Windows: %USERPROFILE%\Application Data\Subversion\config, on Linux: ~/.subversion/config) to enable automatic properties for all repositories and files (according to pattern) you're working with: set enable-auto-props to yes and then add to [auto-props] section: *.html = svn:keywords=Date Author Revision

Satire answered 19/8, 2010 at 6:28 Comment(4)
Can I put latest revison number of directorz into some file? I'd liek have a file with latest trunk revision - how to achieve that?Keeshakeeshond
Yes, you can, if you look at the link in my answer: you need to have 1. add to some file keyword $Rev$ and 2. set property for this file: svn ps svn:keywords "Rev" file. Then, after each svn update, $Rev$ will be replaced with the latest revision. HTHSatire
I still can't find it - I want to have revision number of file A in file B. How do I do that?Keeshakeeshond
This is not possible directly, you can for example post-process keywords in files of interest manually - e.g. with some script to update your file with versions, and then you can go further and with the help of post-commit hooks make this file to be updated automatically, actually, this goes out of svn, however don't know - maybe some plugin exists for eclipseSatire
C
1

If your help files are versioned, I would add an external script as an Eclipse builder in order to make some keyword substitution (using for instance svnversion)

But if your help files are generated, may be this kind of script can help (also based on svnversion to get back the "GlobalRev").

Major and Minor version information need to be stored and retrieved from another souce though: they are not "svn-related" informations.

Case answered 19/8, 2010 at 6:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.