svn getting started with svn

svn 2005. 5. 30. 09:36

간단한 설명, 개인적으로 freebook은 별로 맘에 들지 않는다.

Getting Started with SVN -- A Subversion Tutorial

Author: steven
Category: Tutorial
Written: January 03rd 2005
A couple years ago my friend and I were using CVS for version control on his server. I remember it took awhile to get CVS going, as I had to edit xinetd and set some permissions up. During development, we suffered--perhaps through our own fault--data corruption. Most notably, our image files for some of the project's icons got messed up.

That server crashed and burned sometime later. When it came to deciding what to go with the next time around, I stumbled on Subversion.

As Subversion had grown out of the frustrations and limitations of CVS, it seemed a natural replacement. The command line usage looked similar, so the learning curve wouldn't be too rough.

The first thing you need to do is create a Subversion repository. This is done through the svnadmin tool:

>svnadmin create svn-repository

Now you'll have a repository, which is really just a folder with some folders with names like conf, dav, db, hooks, and locks.

I should note that as of Subversion 1.1, there is a new type of storage backend. Traditionally, Subversion has relied on BerkeleyDB, but you can specifiy the newer--and perhaps less error-prone--filesystem backend at repository creation time. To use the FSFS (filesystem) backend, create your repository like this:

>svnadmin create --fs-type fsfs svn-repository

My first few repositories were BerkeleyDB-based, but I had some problems with my setup and the FSFS backend has proved much less of a pain, being less sensitive to permissions and multiple access methods.

Now that you have your repository, you probably want to import a project. Try this if you want your project to have its own directory within the repository:

>svn import project file:///path/to/svn-repository/project -m "comments"

In the above command, the first project refers to the directory of your project. The project at the end of the file:/// URL refers to what you want the project to be called within the repository (so it can be different).

The -m allows you to specifiy a message about this initial import. Now, within your svn-repository directory you'll have a project by the name of project (obviously change these names to something you like).

To check this project out, you'd type this:

>svn checkout file:///path/to/svn-repository/project local-name

This will dump the project into a folder called local-name. This is now your working copy. It contains code you can read and edit.

If you want multiple projects in your repository, add them as you did above, specifying a new project name for each one. Then you could check them out separately like this:

>svn checkout file:///path/to/svn-repository/prj1 prj1
>svn checkout file:///path/to/svn-repository/prj2 prj2
>svn checkout file:///path/to/svn-repository/prj3 prj3

The catch here is that Subversion does version numbering on a per-repository basis. This means that if you edit and commit to prj2, then the next checkout of, say, prj3 will share that same revision number. There's nothing wrong with this, but if you're like me you'll want a separate revision number for each project.

For that, use separate repositories for each project. For example, say I had a project called blur6ex and one called Advocate:

>svnadmin create file:///usr/svn/blur6ex
>svnadmin create file:///usr/svn/Advocate

>svn import /home/code/blur6ex file:///usr/svn/blur6ex -m "initial"
>svn import /home/code/Advocate file:///usr/svn/Advocate -m "initial"

Now I can check each one out separately and the versions are different for each project. It's not like there's any overhead for this.

Now some quick command to get started with these repositories.

To do a checkout:
svn checkout file:///usr/svn/blur6ex blur6

To commit (from your working copy directory):
svn commit -m "list changes here"

I need to go look at my httpd.conf setup to show you how to access these repositories in ways other than the file:/// urls.

One of Subversion's coolest features is the free book that guides you through everything.


'svn' 카테고리의 다른 글

svn 명령시 깨지는 글자나 나타날 때.  (0) 2005.11.01  (0) 2005.06.10
svn freebook  (0) 2005.05.30
tip) 파일 하나만 Rep에서 가져오기  (0) 2005.05.30
TortoiseSVN  (0) 2005.05.30
Posted by '김용환'

댓글을 달아 주세요