r8 - 13 Jun 2013 - 19:29:49 - PaulDickeyYou are here: TWiki >  CSDocs Web  >  CSLDocumentation > FileSharingAndSVNHowTo

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 (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. FSFS is the default, and is good for most repositories. The alternative, BDB, 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 FSFS and that your repository is in AFS.

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.

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:

mkdir repository_path

Now, add write access for your AFS group. Run afs_rseta as follows:

afs_rseta repository_path frida:cs736-group write

Windows computers do not have an afs_rseta command available. We recommend you set the ACLs on your repository command using fs setacl or via the Windows Explorer by right-clicking on the directory and opening AFSAccess Control Lists.... You can find information on how to use fs setacl 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 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:///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 svn+ssh://username@repository_host/remote_path_to_files in place of the file:///... path in the above examples.

For Windows workstations, your file repository reference should look something like this:

file://afs/cs.wisc.edu/u/f/r/frida/repository/project1
file://localhost/u:/f/r/frida/repository/project1

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 svn+ssh applies for Windows too; however, the CSL recommends using one of the formats above. If it is necessary to use the svn+ssh repository definition, some things to keep in mind:

  1. You may need a copy of PuTTY, a free SSH client, available on your computer; SecureCRT will not work for SVN repository access.
  2. 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 cs736-group 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 checkout elsewhere.

The project1 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 cs736-p2 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 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 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:

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 dir 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:///u/f/r/frida/repository/project1 my-export

Final Note

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.

-- PaulDickey - 13 Jun 2013

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r8 < r7 < r6 < r5 < r4 | More topic actions
 
CSL Home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback