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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ViH
Forum Newbie
Posts: 3
Joined: Fri Feb 27, 2009 5:16 am

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

Post 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?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

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

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

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

Post 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.
ViH
Forum Newbie
Posts: 3
Joined: Fri Feb 27, 2009 5:16 am

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

Post 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.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

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

Post 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.
Post Reply