Subversion

From John Freier
Jump to: navigation, search

Install SVN

This install uses Fedora Core 4, with YUM.

1. Install subversion

>yum install subversion

2. Create a nice directory structure to keep all the subversion information.

>mkdir /svn
>mkdir /svn/repos
>mkdir /svn/users
>mkdir /svn/permissions

3. Create our first repository.

>svnadmin create /svn/repos/myproject

4. Edit the config for the newly create repo.

>vi /svn/repos/conf/svnserve.conf

and add these three lines, or un-comment them.

anon-access = none
auth-access = write
password-db = passwd

5. Create the password file, with a list of users that have access.

>vi /svnrepos/conf/passwd

add users like

user = password

example: tony = mypassword

6. Start the SVN Server

>svnserve -d

7. Test out on another computer with the address,

svn co svn://192.168.1.001/svn/repos/myproject


There is also a good init.d server start/stop file out there, just browse backups.


Sources:
http://vengatctech.wordpress.com/2008/08/22/installing-svn-on-fedora/
http://www.tonyspencer.com/2007/03/02/setup-a-subversion-server-in-4-minutes/

Add a bunch of files in one line

svn stat | grep "^?" | awk '{print $2}' | xargs svn add

Explination 1. svn stat tells you the status of all the files in the directory with a question mark at the beginning of the line for any files that svn doesn't currently know about (i.e. that aren't under revision control). 2. The next step is to pipe that to a grep command that looks for lines beginning with a question mark so that we can add only those items to svn. 3. Next, since the output of svn stat is a two column listing split by whitespace with the status indicator first and the full path to the file second, we use a simple awk pattern to print out just filename 4. Finally, we use the xargs command to take the input and pass it on to the svn add command which schedules the files to be added to the repository.

I will typically run svn stat | less first and review the output to make sure that the command is only going to add things I want. I do the same thing just before any commit. If you need to undo the addition of some file prior to the commit, simply svn revert filename or use the recursive flag like svn revert --recursive path/to/directory/ if you are dealing with a directory.

Once you're happy with the changes, all you need to do is an actual svn commit so that the files will be permanently added to the repository.

Commit

svn commit -m "first commit" --username=USERNAME --password=PASSWORD