url = '$HeadURL: https://mysvnserver.somewhere.com/svn/myproject/branches/iso_mybranchortag/python_version.py $' ver = '$Rev: 531 $' print url print ver branch = url.find("branches") tag = url.find("tags") trunk = url.find("trunk") if trunk > 0 : print "This version was taken from the trunk!" elif tag > 0 : suburl = url[tag+5:tag+99] endindex = suburl.find("/") print "This version was taken from tag " + suburl[0:endindex] elif branch > 0: suburl = url[branch+9:branch+99] endindex = suburl.find("/") print "This version was taken from branch " + suburl[0:endindex]In order to make this work, you need to add keywords to your code. If you are working with Tortoise you can make these setting in the GUI.
An example of keyword substitution at work:
C:\Users\greger\test\tags\rc001>more version.txt $Date: 2009-07-07 21:34:58 +0200 (ti, 07 jul 2009) $ $URL: http://localhost/svn/test/tags/rc001/version.txt $ This is a little text file C:\Users\greger\test\tags\rc001>more ..\..\trunk\version.txt $Date: 2009-07-07 21:34:58 +0200 (ti, 07 jul 2009) $ $URL: http://localhost/svn/test/trunk/version.txt $ This is a little text fileBoth version.txt files above will be on the same revision. In my case "9".
3 kommentarer:
So, when I came home. I decided to install SVN on my home computer and play around a bit. Turns out there was some information missing but here it is: You need to start the services after installation. Also read this and this.
A further comment. If you look in the http directory, the $Keyword$ will not be expanded. Also note, if the $tag$ is added before the property is set, it will not be expanded.
Keep adding comments to this. And yes, now I can confirm that this method works. But first I needed a little help on creating a tag.
Skicka en kommentar