Danijel Danijel - 1 year ago 190
Python Question

pysvn: How to get revision number?

Using pysvn to handle my SVN source repository via Python.

client = pysvn.Client()
revision = client.update(path)

How can I print

This doesn't work:

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

documentation here.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download