[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Python bindings to get working copy revision

From: Didier Trosset <didier_trosset_at_agilent.com>
Date: Thu, 21 Aug 2008 10:17:49 +0200

In the middle of a python script, I am willing to get the revision number of
the current directory. I have tried to get into the SWIG svn-python
bindings, but they look so huge, I am having difficulties to know what to
start with.

I ended up writing the following that uses the command line:

     # Get revision from svn command line on repository
     revision = 0
     fileRev = popen("svn info .", "r")
     for line in fileRev:
         if 'Revision' in line:
             revision = match("Revision: (\d+)", line).group(1)

It works and I am pretty happy with it. But could someone indicate me what
would be the code to do the same thing using the python-subversion bindings.

Didier

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-21 10:18:18 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.