Page 1 of 1

SVN repository: how to read and save a file from php?

Posted: Fri Feb 27, 2009 5:27 am
by ViH
There is a SVN repository:
svn://localhost/repos

I need, from php, to read a .xml file (test.xml) from the repository, make some changes in it and then write it back to the repository.

Could you help me, how it can be done?

Re: SVN repository: how to read and save a file from php?

Posted: Fri Feb 27, 2009 5:49 am
by VladSun

Re: SVN repository: how to read and save a file from php?

Posted: Fri Feb 27, 2009 7:14 am
by Eran
You should be working against a working copy, not the repository itself. Check out the file (or the entire project if you need more), and commit after every change.

Re: SVN repository: how to read and save a file from php?

Posted: Fri Feb 27, 2009 7:27 am
by ViH
pytrin wrote:You should be working against a working copy, not the repository itself. Check out the file (or the entire project if you need more), and commit after every change.
I simply need to change the .xml file.
But I have no any means to do it. I don't know how to create the working copy using php, and how to commit the file.

Re: SVN repository: how to read and save a file from php?

Posted: Fri Feb 27, 2009 8:11 am
by Eran
You should be learning how to work with SVN if you want to use it properly - http://svnbook.red-bean.com/en/1.5/index.html.
You use "svn checkout" to check out a working copy out of the repository. you use "svn commit" to commit changes into the repository. Vlad gave you a link to the PHP functions that activate those commands if you don't want to use shell access.