Sharing Files/Using Subversion (SVN)
This document explains how to set up
for sharing files, and also how to use
for version control. This document was adapted from our documentation on CVS
. Users who are going to use
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 (using the Windows Explorer, right-click on any given file or directory and look for "TortoiseSVN" in the drop-down menu for SVN commands).
Before you begin
First, you need to decide what kind of repository backend (how your files are stored) you want to use.
is the default, and is good for most repositories. The alternative,
, can provide some advantages with very large
repositories but will not work with AFS, so local filesystem space must be allocated for the project and requires extra care in setting up permissions. If this is necessary for any reason, please contact the CSL
. For the remainder of this document, we will assume you are using
and that your repository is in AFS.
Setting Up AFS Groups For Sharing Files With Other Users
You want to set up a
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
Now, choose where you're going to store your repository. This is not where your working copy of the files will be, but where the master copies, and all previous revisions, are stored. Create the directory for the repository as follows:
Now, add write access for your AFS group. Run
afs_rseta repository_path frida:cs736-group write
Windows computers do not have an
command available. We recommend you set the ACLs on your repository command using
or via the Windows Explorer by right-clicking on the directory and opening
Access Control Lists...
. You can find information on how to use
on our AFS How-To
page. Subdirectories and files created in this directory with an SVN "import" will inherit the parent directory ACLs. Memberships of the PTS group(s) used in ACLs can be easily modified at any time, but it is important to get the group ACLs set correctly before first establishing the repository.
Creating The SVN Repository
Now that you have permissions set up on the directory, it's time to tell subversion that the directory is going to be a repository:
svnadmin create repository_path
Next, import data into your repository:
svn import mytree file:///repository_path -m "commit message"
This will import the contents of directory
. If you want your repository to keep all the files under a
directory within the repository, you should make sure your repository_path
at the end of the directory name like this:
svn import project1_files file:///u/f/r/frida/repository/project1 -m "importing project1 files"
It is worth mentioning that if you need to connect to an offsite computer to import data to your repository, you can use
in place of the
path in the above examples.
For Windows workstations, your
repository reference should look something like this:
The first format will attempt to access files directly via the AFS client on your workstation. The second uses the AFS client through its local drive mapping.
The same mention about
applies for Windows too; however, the CSL recommends using one of the formats above. If it is necessary to use the
repository definition, some things to keep in mind:
- You may need a copy of
PuTTY, a free SSH client, available on your computer;
SecureCRT will not work for SVN repository access.
- You will need to make sure GSSAPI authentication is disabled in the connection profile to repository_host. This will force a password prompt with each SVN operation, but it will also make sure your SVN operations are authenticated on repository_host when your repository is housed on an AFS filesystem.
Checking Out A Copy Of The Repository For Editing
Now each user in the
group should 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
You should never manually modify files in the repository_path
directory, so make sure that you do NOT
do this checkout while in the repository_path
directory! Run your
example above would look like this:
svn checkout file:///u/f/r/frida/repository/project1
This only needs to be done once for each user in the group. It will create your
working directory as a subdirectory of your current directory, which only you have access to. You can now safely edit files in your copy of the source tree without fear of your changes causing concurrency problems 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
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
- 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.
If you make any changes to files in your "sandbox", you will need to
them before others in your workgroup can access them. The command to do this is as follows:
svn commit -m "commit message"
... where commit message
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 need to update your own sandbox before you will see those changes. To do this make sure you are in your sandbox directory and run:
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
command is very handy.
works much like
, 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
; you would run this from within your project sandbox. The second form will export from the
. The examples using user "frida" above would look like this:
svn export project1 my-export
svn export file:///u/f/r/frida/repository/project1 my-export
SVN is a very full-featured revision control system. This document gives you the minimum information you need to know to get started with a project, but there are many other features which are useful. Refer to the Subversion Book
for information on them.
- 13 Jun 2013