Subversion

From GeodesyLab
Revision as of 21:05, 24 April 2008 by Ronni (Talk | contribs) (Share only parts of your work)

Jump to: navigation, search

What's that all about?

The idea is very old and popular in software development: have somebody keep track of changes you make to a product and hence remain able to go back in history...

The idea behind our set up is to allow for anonymous public access of specific products (parts) which are simultaneously changed/updated/further developed. So keep in mind that the initial set-up gives the whole world reading access to your project. If you want to share only parts of it, additional steps must be taken. Those are described at the very end of this page.

Existing Geodesy-Lab projects and anonymous access

Anonymous access is read-only. Currently any existing project can be retrieved using:

svn checkout svn://svn.gps.alaska.edu/<PROJECT-NAME>

Pre-requisites

- unix account at geodesy lab
- member of group 'svn'
- local installation of a subversion client (comes with most linux dists, check http://tortoisesvn.tigris.org/ for a (graphical) windows client)

General set-up cycle

Setting up a new project-root

- login to fairweather
- cd to $SVNREPO
- execute 'svnadmin create <PROJECT-NAME>'
- exit

Repository layout & initial data import

The repository layout is totally up to you. If you want to make versions available only based on version number, that's fine. However, for a more sophisticated use, the subversion team recommends the following layout:

$SVNREPO
   <PROJECT-NAME>/
      trunk/
      tags/
      branches/
   <my project>/
      trunk/
      tags/
      branches/
   ...

The trunk directory will hold the initial project data. tags and branches are explained below.

- 'mkdir tmpdir'
- optional: 'mkdir tmpdir/trunk' etc.
- copy (not move!) your project files / directories etc. into tmpdir/trunk
- 'cd tmpdir'
- 'svn import . svn+ssh://username@svn.gps.alaska.edu/<PROJECT-NAME> -m "initial import" '

You will be asked for your password. The long list of characters that pops up on the screen should end with something like:

Committed revision 1.

- 'cd ..'
- 'rm -rf tmpdir'

Your project is now accessible by the world! yeah.

Initial checkout

To have subversion keep track on the changes you do to your project you will have to work on a working copy of your project from the repository:

- cd to a place where you would want to have that working copy - 'svn checkout svn+ssh://username@svn.gps.alaska.edu/<PROJECT-NAME>/trunk <PROJECT-NAME>'

I assume you created the recommended directory structure. As I said the whole branches and trunk story will be covered later. Anyway, that's it. You got your own copy and the world can follow your changes. yeah.

General work cycle

The general work cycle is the following:

update-change-commit

This is essential; especially if several people work on the same project. At several points you will need your password - sometimes multiple times.

Update your working copy

svn update [file | directory]

subversion will compare your working copy against parts or the whole project. Outdated files will be updated. If local files have changes that are not yet committed and an update is necessary, svn tries its best to merge the files. However, conflicts may arise and have to be solved by talking to people and then informing subversion about the result (see 'svn help resolved'). You can update a single file or a subdirectory by either giving the respective parameter or 'cd' into that directory.

Change your working copy

Use your editor /program to change the textfiles /binary products. subversion will know about what has changes (magically :) ). However, if you do stuctural changes to the project (adding of files, renaming, moving, copying, new directories, etc.) subversion must know about that. Instead of using the common unix commands for doing so, use:

svn add [file | directory]
svn [copy | move | delete | mkdir ...]

If you need help on the syntax of a specific command or a full list of commands:

svn help

helps.

Commit your changes

Whatever you did is only locally known.

svn commit [file | directory]

Works in the same way as svn update, only in the other direction. Hence, the repository will be updated with your changes. You will get the opportunity to comment on the changes you made. Make good use of that - it will help in the future! Subversion will increase the revision number and add your comments to the history.

Share only parts of your work

http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.serverconfig.svnserve