# SVN (subversion) repositories¶

We use Apache subversion to manage our SVN repository. If you want to learn more about it, there is a free book about subversion.

This document uses an example: importing the CS499/src directory to repos.cs.uky.edu. You should adjust these instructions when you create your repository, import files, check out files, or other operations.

ssh repos.cs.uky.edu
cd /repos/$USER  ## Create a repository¶ /usr/local/bin/csrepo -n project5 -p paul,hayes,calvert,raphael  This command allows the following users to make changes: paul, hayes, calvert, raphael. Only the creator of the project needs to run this command. The other team members do not. In this case, assume paul is the owner. ## Import files to your SVN repository¶ Assuming you have a directory called CS499/src in your home directory, and you want to import it into your SVN repo, then on any machine that has that directory: svn import ~/CS499/src "svn+ssh://repos.cs.uky.edu/repos/$USER/CS499" -m "Initial Import"


The program prompts you for your password and then imports the directory into the repository, and it outputs something like the following.

svn+ssh://repos.cs.uky.edu/repos/paul/project5
aaaaaaa   bbbbbbbbbbbbbbbbcccccccccccccccccccc

aaaaaaa = the protocol, svn over SSH, required.
bbbbbbb = the host, accessible from the Internet
ccccccc = the directory.


Note

/repos is the top-level, paul is the repository “owner’s” CS userid. project5 is the name you gave it in step 3. -m “Initial Import” is a comment. It is typed on the same line!

Note

If you want to creat a subdirectory, specify it in the URL like this:

svn import ~/CS499/src/ "svn+ssh://repos.cs.uky.edu/repos/paul/project5/src/" -m "Initial Import"


This command creates and populates the src directory in the project5 repository.

## Checking out a file¶

All project members can check out the files.

Note

Check local permissions when directories are created to make sure they have proper settings.

mkdir testrepo
cd testrepo
svn checkout "svn+ssh://repos.cs.uky.edu/repos/paul/project5"
ls -la
# ....make some changes to a file
svn update project5
# ....grab any updates before committing
svn commit project5
# ...add new file to project
touch newfile
svn commit


## Other commands¶

Once you have a local checkout of your SVN repository, you can see the status of its files

svn status -v  # local status
svn status -u  # contact the server to determine file differences
svn info "svn+ssh://repos.cs.uky.edu/repos/paul/project5/"
svn ls "svn+ssh://repos.cs.uky.edu/repos/paul/project5"


Important

Conflict resolution is a manual process and is needed if two users edit the same file. See the official documentation about resolving conflicts.