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".