开发者

Subversion (svn) beginner's questions

Here's what i'm trying to do. I have a project in /var/www/project. I'd like to use svn for this project. I've installed SVN on my debian server for this purpose, bu开发者_如何学编程t i don't understand how to use it and the googling got me even more confused. I'd like to create a repository /var/svn/project and use it. After some changes occur, i'd like to export all the code back to /var/www/project. Now here's what i've done:

  • i've created a repository: svnadmin create /var/svn/project
  • i've imported the code: svn import /var/www/project file:///var/svn/project -m "Initial import"
  • i've checked out the code with "Versions" client

Everything seems to work fine, but ... If i go to /var/svn/project, there are no source files from my project there or in any subdirectory. Although the svn client is able to checkout all of those files. So i've read that in svn, files are not stored separately neither in berkley db nor in fsfs filesystems. Then the question is ... how do i export the source back to /var/www/project? If i do an svn export command on the /var/svn/project directory, it says i'm not in a working copy :(


First of all you're correct that SVN uses a database structure to store (the changes to) your files so you shouldn't expect to see the raw files in the repository folder.

Once you've created a repository you almost never need to do anything else in that directory, except for configuration stuff (user authorization for example).

All your work should go on in working copy directories.

To get the code into your www folder type:

cd /var/www/project
svn checkout /var/svn/project

Now you can edit code in that working directory (/var/www/project) as you want. When you want to commit these changes type

svm commit -m "Commit message"

And the changes will go back into the repository.


Firstly, I recommend http://svnbook.red-bean.com/ as a reference.

You want to export from your repo to your location. You can achieve this via:

svn export file:///var/svn/project /var/www/project

Also of note, as I'm sure you have realised now, is that you cannot simply go to your repository directory and view your files since they are stored in a database at that location, not as loose files.


you would run the svn export command from the client side to export a clean tree to some other path on your client box or another repository. it sounds like /var/svn/project is your repository (server)

if you mean to export directly from your repository, use svn export file:///tmp/repos my-export


Make sure it did not put the files in /var/www/project/project instead.


Check out the source (to create a working directory), then use svn export within your checked-out copy to export it somewhere else.


Svn saves files in its own database system. If you want to replace the code in /var/www/project with an exported version, you have to call export on a working copy. You should consider removing /var/www/project (backup first!) and replace it with a wokring copy.


You could consider using a distributed version control system such as Mercurial.

It's as easy to use as subversion. Indeed it may be better when the repo is on a local filesystem (as opposed to a server) because one of my colleagues said that svn is deprecating FSFS storage (I can't find a reference for this).

For infromation on mercurial, see this link below. I wish I never bothered with svn.

http://hgbook.red-bean.com/read/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜