[Tutor] pysvn samples
Bill Burns
billburns at pennswoods.net
Sat Dec 16 20:20:52 CET 2006
> I am looking to experiment with pysvn and was wondering if anyone knew
> of a location for code samples/snippets using it?
>
> I'm reviewing the pysvn programmers guide and tutorial but some live
> examples would be great.
>
> If anyone can point me at something, it would be appreciated.
>
Hi Andy,
Here's some examples, which are not very elaborate, but I use them
frequently (most of them you can get out of the programmer's guide).
I'm using Windows and I have a 'working copy' checked out into the
directory 'C:\dist'.
<examples>
import pysvn
client = pysvn.Client()
# Updates my working copy.
client.update(r'C:\dist')
# Maybe just get the revision number?
rev = client.info(r'C:\dist').revision.number
print rev
# Commit or checkin some changes.
client.checkin(r'C:\dist', 'A log message goes here')
# Do a checkout from a local repos. Note: if some_dir
# does not exist, it will be created. 'C:\svn\FilePrinter'
# is a repos of mine, substitute your own ;-)
client.checkout('file:///C:/svn/FilePrinter', r'C:\some_dir')
# Do a checkout from a remote repos.
client.checkout('http://svn.pybrary.net', r'C:\pyPDF')
And you can also fire up the interpreter and do things like:
>>> import pysvn
>>> pysvn.version # get the pysvn version
(1, 5, 0, 742)
>>> pysvn.svn_version # get your Subversion version
(1, 4, 0, '')
>>> help(pysvn.Client().checkout) # get some help on checkout
</examples>
There's also several pysvn mailing lists
http://pysvn.tigris.org/servlets/ProjectMailingListList
and five (5) pages of hits from 'Google Code Search'...
HTH,
Bill
More information about the Tutor
mailing list