james_dean
james_dean

Reputation: 1517

Automating Subversion Commands using Python

I am pretty new to Subversion, and not that experienced in Python, but am doing some work with large volume of media-files that need moving around within the directory. Using the Visions GUI, some of the file transfers are taking a very long time, so I'd like to automate these tasks to run over night by storing the actions within a text file and then having a python script act on these overnight?

For example the text file might contain a command such as:

svn mv current desired

How can I send this string to Terminal to execute the command?

Upvotes: 3

Views: 3282

Answers (3)

user1277476
user1277476

Reputation: 2909

If you're on Windows, it'd be better to use an SVN library. On Linux/Mac/Unix you could go either way realistically, because these can run a subprocess well - windows doesn't do terribly well at this.

subprocess is indeed preferred over os.system today.

The nice thing about using subprocess.Popen instead of an SVN library (module), is that you don't have to learn two ways of accessing SVN. Your command line SVN knowledge translates directly into your code.

Upvotes: -1

Ned Batchelder
Ned Batchelder

Reputation: 376022

The subprocess module is the best way to execute commands. As @Abgan points out, the better way might be to use a subversion library instead.

Upvotes: 0

Abgan
Abgan

Reputation: 3716

You could do os.system call or try using PySVN, which may give you more control in Python over SVN repository you're working with.

Upvotes: 4

Related Questions