Wednesday, October 29, 2008

SVN tips

I'm going to keep track of some SVN tips here. For instance I always get confused about when I'm supposed to use a URL and when I'm supposed to use a path with SVN. And I always have to recreate those annoying trunk/ branch/ and tag/ directories every time I want to import a project and sometimes if you do it wrong you're truly screwed. Hopefully this will help you (and me) out in future.

Create a repository and import a project

svnadmin create --fs-type fsfs /home/kjvarga/svnroot svn import newproject file:///home/kjvarga/svnroot/newproject/
Some things to notice
  • The triple slash on the local file URL.
  • Specifying the file store type as fsfs. I'm on a shared host and apparently it's really not a good idea to use the BerkleyDB in this scenario. I found out the hard way when after about 4 months of no problems I was suddenly unable to access my repository (something about a BDB version mismatch).
  • In this scenario newproject has the structure newproject/trunk tags branches.
  • Don't forget to append the directory name to the SVNROOT in the import. Otherwise the contents of newproject/ will be imported to the root of your SVNROOT, which isn't very useful.
Verify your import with svn list file:///home/kjvarga/svnroot/newproject/

Checkout your import

The next logical step is to checkout the project you just checked in.
svn checkout file:///home/kjvarga/svnroot/newproject/trunk svnproject

Don't forget that you're checking out the trunk/ directory!

If you're not checking out the project locally you will need to supply a URL pointing to the repository resource.

I'm on a shared host which doesn't allow any direct access to SVN so I have to connect using ssh+svn. In taht case your checkout would look something like this:

svn checkout svn+ssh:// newproject

1 comment:

Blogger said...

DreamHost is ultimately the best web-hosting company for any hosting plans you might need.