SVN Source code revision numbers

Developer
Dec 22, 2009 at 6:02 PM

Is there any possibility of adding support to use SVN revision numbers as a version style?  I think the best way to do this would be to pull the revision from the current directory of the project file.

For me, I think the ideal version number would be:

Major.Minor.Time-or-increment.SVN-Revision

or some variation similar to that.

 

A discussion thread below mine mentions SVN, but it sounds like a bit of a hack the way it is described.

 

Thanks for this great tool!

Dec 23, 2009 at 10:03 AM

Hey,

Yes, I think an option to pull the SVN version from its files would be good. You could probably acheive this via reading the "entries" file inside the root .svn folder.

So Inside "<MyProject>/.svn/entries" is the following for example: (I think its on newlines as wordpad displays it, I've removed duplicate new lines for readability

Bolded and underlined the SVN revision number to use.

10
dir
9023
http://dev12:8080/svn/product/trunk
http://dev12:8080/svn/product
2009-12-22T17:14:17.659318Z
9023
Phil
has-props
5edb0649-0bhr-8f34-a25c-1t67d42c5j9a
product.stuff
dir
product.sln
file
2009-12-23T10:25:39.152282Z
e46d15ed6031bcc267fajcab94bd5129
2009-12-02T10:02:00.235913Z
906
Phil
2563
product.Dev
dir
product.SQL
dir
product
dir
product.Tests
dir

Developer
Dec 31, 2009 at 3:18 PM

If someone isn't already working on this, and if the project people are wanting to add this SVN revision feature, I'd be willing to take a look into adding it.

Developer
Jan 4, 2010 at 6:13 PM

I'd be happy to help!

Developer
Jan 5, 2010 at 3:21 PM

I've been looking into various ways to do this.

 

The first way would to get the revision number is the way philjones suggests above.  It may also be better to grab the next number on the list, which I believe is the latest committed revision.  This would helpful for tags and branches.  If you're building a tagged branch, you probably are more interested in the latest revision of that tag, rather than latest revision of the repository, which will likely be completely different.

 

The second and third option are both using command line tools: "svn.exe info" and "svnversion.exe"  These are both part of the subversion package, and could probably be bundled without too much fuss.  Of course, it would still mean relying on an external tool which isn't very desirable.

 

Another option is to use SVNSharp http://sharpsvn.open.collab.net/, however I believe its just a .Net wrapper around the command line tools.  If that's the case (I need to do a little more research), it would probably be overkill to bring in.

 

So this first option seems the most attractive as it would be the most lightweight.  However, I'd like to find out for sure if this "entries" file format is dependable and consistent for everyone.  I imagine the SVN folks would prefer we use their tools or API, but I don't know that for sure.

Developer
Jan 18, 2010 at 1:57 PM

Hey, any news on the patch I emailed?

Developer
Jan 18, 2010 at 9:08 PM

Awesome, thanks!  Let me know if you have any questions.

Developer
Jan 19, 2010 at 1:54 PM

I just checked out the licensing situation, and the GPL website indicates that Apache v2.0 is compatible, which is what the SharpSvn libraries are using, so you should be good there.

http://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses

There's a number of licenses included with SharpSVN, but since the only library that needs to be distributed is the SharpSVN.dll, I don't think you'll have to worry about the rest.

 

Jan 22, 2010 at 12:58 PM

This is really good stuff - thank you and grimus for providing this helpful feature!

Is there a download available with this patch? Or better: when do you think comes this feature into the stable or into the beta version?

 

Developer
Feb 10, 2010 at 7:03 PM

Hey, is there any news on this?

Would it be helpful if I resubmitted the patch on the Source Code page?

Developer
Feb 12, 2010 at 2:49 PM

Alright, sounds pretty cool.  I feel honored to be a feature starter :)  I'll keep an eye out for when you guys have more details on the plug in system.

May 15, 2010 at 9:47 PM

Hey, any news on this? Version 2.2 is out but no VSN support.

Coordinator
May 16, 2010 at 10:39 PM

Grimus created a plugin that does the trick.

http://happyturtle.codeplex.com/

Apr 27, 2011 at 6:50 AM
Edited Sep 15, 2011 at 8:23 AM

I also created a plugin using Sharpsvn before I found this post - extra work for me ;-(

http://www.crea-doo.at/weblog/2011/04/26/automatically-use-subversion-revision-as-version-in-net-projects/