PySvn: commit a file built from scratch

  pysvn, python

I’d like to commit a file using pysvn.

Here is the code from the documentation:

import pysvn
# edit the file foo.txt
f = open('./examples/pysvn/foo.txt', 'w')
f.write('Sample versioned file via pythonn')
# checkin the change with a log message
client = pysvn.Client()
client.checkin(['./examples/pysvn'], 'Corrected spelling of python in foo.txt')

Do I have to open the file that i want to commit in the first place?
How do i have to proceed if i built a file from scratch and want to use it to replace an existing file in the svn repo?


Source: Python Questions