pysvn is one of those packages I use only occasionally but every time I need it, it comes up to scratch. And the simplicity of the API combined with the helpful examples covering all the major uses means that I’m up-and-running in minutes. Seconds, even.
The latest bacon-salvation need arose from code.google.com’s apparent inability to accept large commits to its Subversion repositories. I was getting spurious 502 errors again and again. So, one 10-line script later and we’re committing 100 changes at a go. Took a while but it worked.
import pysvn svn = pysvn.Client () while True: adds = [f.path for f in svn.status (".") if f.text_status == pysvn.wc_status_kind.added] if not adds: break added = adds[:100] print "Added", added[0], "to", added[-1], "leaving", len (adds) - len (added) svn.checkin (added, "Suitable message")
Brilliant! Thanks, pysvn.