Subversion commit from Python?
Duncan Booth
duncan.booth at invalid.invalid
Tue May 19 03:46:42 EDT 2009
Jack Trades <JackTradesPublic at gmail.com> wrote:
> Originally I had the 'data' directory in the same directory as the cgi
> scripts and was using os.system("svn commit"), however I kept running
> into weird bugs with this method. So I moved the data directory out
> of the cgi directory and plan to use a separate repository. So is
> there a prefered way to commit this directory to a subversion
> repository from a Python script?
Subversion has Python bindings, but for a friendlier interface have a look
at http://pysvn.tigris.org/
An example from the docs at
http://pysvn.tigris.org/docs/pysvn_prog_guide.html:
Commit changes to the repository
import pysvn
# edit the file foo.txt
f = open('./examples/pysvn/foo.txt', 'w')
f.write('Sample versioned file via python\n')
f.close()
# checkin the change with a log message
client = pysvn.Client()
client.checkin(['./examples/pysvn'], 'Corrected spelling of python in foo.txt')
--
Duncan Booth http://kupuguy.blogspot.com
More information about the Python-list
mailing list