SVN doesn't know about versions other than a single index for the entire repository.
So to kludge up a way to get names versions we use the HeadURL property and a convention about tags and naming of versions.
An example shows it best. I put this into a file (in this case "..../python/__init__.py) and ran
svn propset svn:keywords HeadURL <filename>
# Initally this string was simply '$HeadURL: $'. SVN fills in the URL each time the file is updated.
# for tags this should be fixed then.
_property_headurl='$HeadURL: https://some.address/svn/myrepo/tags/v1.5.1/python/__init__.py $'
def GetVersion():
import os
from sys import stderr
thisname='/python/__init__.py'
badvers="NOTAG: unparseable"
psplit=_property_headurl.split()
if len(psplit) != 3:
mess="headurl did not split into 3: '%s'\n" % _property_headurl
stderr.write(mess)
return badvers
url=psplit[1]
# here we use convention of tag naming
if url.find(thisname) == -1:
mess="url '%s' does not contain string '%s'\n" % \
(_property_headurl, thisname)
stderr.write(mess)
return badvers
urlfront = url.replace(thisname, '')
tag = os.path.basename(urlfront)
return tag