Subversion commit from Python?

Jack Trades JackTradesPublic at gmail.com
Tue May 19 09:24:26 EDT 2009


On May 19, 3:46 am, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
> Jack Trades <JackTradesPub... 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
> athttp://pysvn.tigris.org/
>
> An example from the docs athttp://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 Boothhttp://kupuguy.blogspot.com

Thanks that's what I was looking for.



More information about the Python-list mailing list