From charlesreid1

Installation

Configuration

I configured subversion version 1.5.2 with the following configure line:

#!/bin/sh
# 
# run this configure script
# make
# make install

./configure \
 --prefix=/path/to/subversion \
 --with-ssl \
 --without-berkeley-db \
 --enable-swig-bindings=no \
 --with-apxs=/path/to/apache/bin/apxs \
 --with-neon=/usr/local \
 --with-apr=/path/to/apache \
 --with-apr-util=/path/to/apache

I have to point subversion to apache so that it can handle subversion repository addresses that begin with http:// or https:// (as opposed to the default svn://, which works fine out of the box).

Dependencies

To install subversion with the above configure line, I had to install Apache, and I also had to install Neon, which is an HTTP and WebDAV client software. It is required for the http:// and https:// repository addresses. It's available from http://www.webdav.org/neon/. I install it to /usr/local/, and without any particularly special configure line (just ./configure).

SVN Guide

Updating

update working copy to be up-to-date with repository:

$ svn update
A = added
D = deleted
U = updated
C = conflicted
G = merged

Making changes to a working copy

Adding file/directory/symbolic link:

$ svn add foo

If foo is a directory, it will be added recursively.

To only add foo itself, use --non-recursive (-N) argument

Deleting file, directory, or symbolic link:

$ svn delete foo

If foo is a directory, it is not immediately deleted, but is SCHEDULED for deletion.

When you commit changes, it will be deleted.

Copy a new item (new) from an old item (old):

$ svn copy old new

To move a file from location1 to location2:

$ svn move location1 location2

This is the same as running svn copy location1 location2; svn delete location1

To make a new directory:

$ svn mkdir foobar

This is the same as running mkdir foobar; svn add foobar

foobar is a new directory that is created and scheduled for addition

Submitting changes

First, you can check what files you have changed:

$ svn status

Next, you can check exactly what changes you have made:

$ svn diff

or you can diff a particular file:

$ svn diff file

(or, to pipe into an external file and review changes there:)

$ svn diff > diff_file

If you are happy with your changes, then commit your changes:

$ svn commit -m "your log message here"

Alternatively, if your $EDITOR environmental variable is set, you can run

$ svn commit 

and the editor will open, and you can enter your log message there (good for complex log messages).

If you want to commit a particular file, just specify that file when you run the commit command:

$ svn commit file1 file2 file3 -m "your log message here"

Looking at differences

The command to see the differences between your working copy and the repository copy is

$ svn diff

To look at differences between different revisions:

Example: Compare revision 3000 to revision 3500 using “@” syntax:

$ svn diff http://svn.collab.net/repos/svn/trunk/COMMITTERS@3000 http://svn.collab.net/repos/svn/trunk/COMMITTERS@3500
Index: COMMITTERS
===================================================================
--- COMMITTERS  (revision 3000)
+++ COMMITTERS  (revision 3500)
...

Example: Compare revision 3000 to revision 3500 using range notation (you only pass the one URL in this case):

$ svn diff -r 3000:3500 http://svn.collab.net/repos/svn/trunk/COMMITTERS
Index: COMMITTERS
===================================================================
--- COMMITTERS  (revision 3000)
+++ COMMITTERS  (revision 3500)

Example: Compare revision 3000 to revision 3500 of all files in trunk using range notation:

$ svn diff -r 3000:3500 http://svn.collab.net/repos/svn/trunk

Working copy information

You can determine the version number of your working copy by running:

$ svnversion

or,

$ svnversion . svn://hostname/project

Trailing letters mean:

M - modified working copy (there have been modifications made from the latest revision of svn://hostname/project)

S - switched working copy (meaning the repository server has been switched)

You can get more information about your local working copy by running:

$ svn info TARGET

(TARGET = working copy or URL)

To get info about a specific revision:

$ svn info TARGET -r

The info command will give you revision number, revision author, revision date and time, and svn server location.

Looking at the log

Usage:

$ svn help log

To look at log message related to changes in the current directory (.), use:

$ svn log

To look at the log messages for changes to a particular folder or file:

$ svn log foobar.cc

To look at the log for a particular revision of a file, use -r:

$ svn log foobar.cc -r 5

To look at the latest revision, use:

$ svn log -rHEAD

Or, look at a series of revisions:

$ svn log -r <min>:<max>

To print all directories affected by the revision displayed, use -v

$ svn log foobar -v

(this may be a lot of output, since it's going all the way back to the initial check-in)

To supress the log messages, and just show info on when an update occurred, use the -q flag:

$ svn log foobar -q

combine to get what you want... e.g. to see the files that were affected by a particular revision:

svn log -r 2 -v


Changing commit properties

You can change properties of svn files and commits by using

$ svn propset

Here are some examples:

Set the mime type on a file:

$ svn propset svn:mime-type image/jpeg foo.jpg
property 'svn:mime-type' set on 'foo.jpg'

On a UNIX system, if you want a file to have the executable permission set:

$ svn propset svn:executable ON somescript
property 'svn:executable' set on 'somescript'

Perhaps you have an internal policy to set certain properties like "owner" for the benefit of repository users:

$ svn propset owner charles foo.cc
property 'owner' set on 'foo.c'

If you made a mistake in a log message for a particular revision and want to change it, use the --revprop flag and set svn:log to the new log message:

$ svn propset --revprop -r 25 svn:log "This is the new log message."
property 'svn:log' set on repository revision '25'

Or, if you don't have a working copy, you can provide a URL:

$ svn propset --revprop -r 26 svn:log "This is the new log message." svn://hostname/repository 
property 'svn:log' set on repository revision '26'

Lastly, you can tell propset to take its input from a file. You could even use this to set the contents of a property to something binary:

$ svn propset owner-pic -F charles.jpg foobar.cc
property 'owner-pic' set on 'foobar.cc'

SVN Server

Some syntax:

Subversion is run as a server or as a client. Users (clients) check out files from a server.

A subversion server can have many different repositories, or it can have just one.

The following guide covers how to set up a subversion server, and how to create new repositories in the server.

Setting up a new SVN server

Stump.gif This section is a stub.

A team of expertly-trained librarian ninjas has been dispatched to research this topic, finish this section, and assassinate all eyewitnesses who contradict their account.

They should be done pretty soon.

Template:Stub

Category:Stubs

Creating a new repository

Step 1: crate a place for the subversion repository

$ svnadmin create /path/to/repositories/repository_name

Step 2: import files into the repository:

$ svn import /location/of/files file:///path/to/repositories/repository_name -m "Initial import"

(You must use file:///path/ syntax, rather than an absolute path).

Step 3: check out code from the new repository

$ svn checkout svn://hostname/repository_name working_copy --username=user