SubVersion Basics

perm url with updates: http://xahlee.org/UnixResource_dir/svn.html

SubVersion Tutorial

Xah Lee, 2009-08-28

This page is a quick start tutorial of using SubVersion (SVN), a version control system.

Basic Check Out, Commit

What commands are available?

Type “svn help”.

How to checkout a project?

cd to a directory where you want the files to be. Then do for example:

svn checkout svn://vmm.math.uci.edu/transvections
svn checkout svn://vmm.math.uci.edu/
svn checkout https://emacs2010.googlecode.com/svn/trunk/ ErgoEmacs --username xahlee

How to commit a change?

Once you checked out, made your modifications, then you can check back in (commit your changes). To commit, cd to the working dir, then do:

svn commit -m "some one-line message summary of what you changed"

How to Add or Remove a dir or file?

If you created new files in your working copy and committed it, that won't work. You will need to run a svn command first to add or remove a file or dir, then commit.

To add, use the add command:

svn add ‹file name›

To remove a file or dir, use the rm command first:

svn rm ‹file name›

Once you are done adding or removing, then you need to do a commit.

How to update your working dir?

Cd to your working dir and use the “svn update” command.

svn update

Creating Projects

How to create a project?

First, create the svn root dir using this command:

sudo svnadmin create /usr/local/svn_rooty

You need do the above. It is not merely creating a dir with “mkdir”.

The “/usr/local/svn_rooty” is the dir you want svn to hold the repository.

To import a project, do:

sudo svn import /Users/xahlee/proj_luv file:///usr/local/svn_rooty -m "Initial import of my lovely project"

the first arg is the path of your folder, the second argument is a url for the svn root path. The “-m” is a comment.

Then, modify the file

/usr/local/svn_rooty/conf/passwd

To contain for example these lines:

[users]
xahlee=xyz
dick=xyz
bob=xzy

The left side is user's login name, the right side is password. This is for running svn as a stand-alone server.

modify the file “/usr/local/svn_rooty/conf/svnserve.conf” to contain these lines:

[general]
anon-access = read
auth-access = write
password-db = passwd
realm = transvections

How to start the stand-alone server?

First, change to svn user.

sudo su svn

Then, run the following command to launch it, while you are “svn” user.

svnserve --daemon --listen-port=3091 --root=/usr/local/svn_rooty 

The “--daemon” is for stand-alone, the “--root=” specifies root, so that in the checkout command it doesn't need to specify the full path.

The default listening port is 3690

What should be the file permissions?

The following dir needs to be owned by “svn” user.

db/
db/revprops
db/revs
db/transactions
db/write-lock

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs