Sharing Files/Using Subversion (SVN)
This document explains how to set up
AFS groups for sharing files, and also how to use
Subversion for version control. This document was adapted from our documentation on
CVS. Users who are going to use
Subversion version control software are encouraged to review the
Subversion Book for further reference in creating and using Subversion repositories. Commands shown here are shown for unix hosts; Windows users will find the same functionality if
TortoiseSVN is installed on their computer.
Creating The SVN Repository
First, you need to decide what kind of repository backend (where your files are stored) you want to use. You have two choices:
FSFS and
BDB. Only
FSFS will work with
AFS filesystems; if the repository is in your home directory, you must use
FSFS.
BDB can provide some advantages with very
large repositories, but local filesystem space must be allocated for the project. If this is necessary for any reason, users are advised to work with
CSL to make sure adequate filesystems are available with data backup before establishing such repositories.
To use
Subversion for version control, you need to create a repository, where the master copies of your files are kept. This only needs to be done once. The syntax for doing this:
svnadmin create repository_path
Next, import data into your repository. Here, you have a couple of options:
svn import mytree file:///repository_path -m "repos-title"
svn import mytree svn+ssh://repository_host/repository_path -m "repos-title"
svn import mytree svn+ssh://user@repository_host/repository_path -m "repos-title"
Any of these forms will import the contents of directory
mytree. If you want your repository to keep all the files under a
mytree directory within the repository, you should make sure your
repository_path includes
mytree at the end of the directory name like this:
svn import project1_files file:///f/r/frida/repository/project1 -m "project1"
The first option access files through the filesystem on the machine you are running the command; the second option will
ssh to
repository_host and run the
svn command there. The only difference between the last two forms of this command is if you are connecting to an offsite computer with a different login name;
user can be specified for the ssh connection in that case. When using computers within the Computer Sciences department, stick with the first two forms above.
Setting Up AFS Groups For Sharing Files With Other Users
You want to set up a
pts group to share files in your AFS space with other users. You can find documentation on how to do this on our
AFS How-To page.
We'll assume you've created a group
frida:cs736-group; to add write access to all the members of this group, you'd want to run
afs_rseta as follows:
afs_rseta repository_path frida:cs736-group write
Checking Out A Copy Of The Repository For Editing
Now each user in the
cs736-group group can create a working directory (also called a "sandbox"), to edit or change project files. To check out a copy of the project tree, a checkout would look like this:
svn checkout repository_path
Do
NOT do this checkout while in the
repository_path directory! Run your
checkout elsewhere.
The
project1 example above would look like this:
svn checkout file:///f/r/frida/repository/project1
This will create your
cs736-p2 working directory as a subdirectory of your current directory, which only you have access to. CVS always knowns where the main repository is because of your
CVSROOT environment variable. You can now safely edit files in your copy of the source tree without fear of your changes conflicting with other users' changes.
Adding New Files To The Repository
Any user can add files to their "sandbox" copy of the repository data, although they will need to tell
Subversion new files have been added, like this:
svn add file1 file2 ...
Things to keep in mind when adding files like this:
- The repository path does not need to be specified; that is stored in your sandbox when you
checkout files.
- Adding a directory will, by default, recursively add files in directory specified to the repository unless you specify not to recurse the directory; consult the Subversion Book for how to do this.
Commiting Changes
If you make any changes to files in your "sandbox", you will need to
commit them before others in your workgroup can access them. The command to do this is as follows:
svn commit -m "commit comment"
...where
commit comment is a comment for you to note what changes you just committed to the repository.
Updating Your Own "Sandbox" Copy
If others in your group have committed changes, you may want to update your own sandbox to make sure your copy of the files are up-to-date. To do this:
svn update
Exporting A Version
When it comes time to turn in an image of the project to the professor or publish your project for others outside your workgroup, the
svn export command is very handy.
svn export works much like
svn checkout, except that SVN files are not created, only an image of the latest version (or whichever version you select).
The command to do this takes a number of forms:
svn export dir my-export
svn export repository-path my-export
The first form will export directory
a-wc into directory
my-export; you would run this from within your project sandbox. The second form will export from the
repository-path into directory
my-export. The examples using user "frida" above would look like this:
svn export project1 my-export
svn export file:///f/r/frida/repository/project1 my-export
You can specify exactly which revision to export; this is documented in the
Subversion Book.
--
JohnPerkins - 21 Feb 2008