Danijel Danijel - 3 months ago 47
Python Question

pysvn: How to get revision number?

Using pysvn to handle my SVN source repository via Python.

path="C:/myrepository"
client = pysvn.Client()
revision = client.update(path)


How can I print
revision
number?

This doesn't work:

print "updated to revision %d" % revision.number


Revision
documentation here.

Answer

You can do the following:

print "Revision: ", str(rev[0]).split(" ")[-1][:-1]

Revision is returned as a list containing a formatted string. The above code tokenizes the string and retrieves the revision number as the last token of the string.

Hope that helps.

Comments