tags:

views:

132

answers:

7

Hello,

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, but 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 :(

A: 

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

David
A: 

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

RedFilter
A: 

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

Amber
+1  A: 

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.

Dan McGrath
Thanks, Dan. I've managed to finaly get the export command working. Maybe i was doing something wrong the first time ;]
Marius
A: 

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.

Danvil
+3  A: 

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 authorisation for example).

All your work sohuld 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.

Mark Pim
+1 haha, the first one to actually show the checkout command (which seems like the right answer to me)
Jugglingnutcase
A: 

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 the sites below. I wish I never bothered with svn.

http://mercurial.selenic.com/

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

blokeley