Search code examples
pythonsvn

How to run SVN commands from a python script?


Basically I want to write a python script that does several things and one of them will be to run a checkout on a repository using subversion (SVN) and maybe preform a couple more of svn commands. What's the best way to do this ? This will be running as a crond script.


Solution

  • Would this work?

    p = subprocess.Popen("svn info svn://xx.xx.xx.xx/project/trunk | grep \"Revision\" | awk '{print $2}'", stdout=subprocess.PIPE, shell=True)
    (output, err) = p.communicate()
    print "Revision is", output