ALPS subversion for dummies

Jump to: navigation, search

OK, so people told you to use subversion and you don't know how. This page should explain the most simple steps.

What does it even do?

The purpose of subversion is to simplify collaboration on files such as source code, LaTeX documents etc. It keeps track of versions (i.e. who did what change when), automatically (most of the time, anyway) merges changes from different authors into a single authorative version which can be distributed to all collaborators, and a few more fancy things.

The most important commands for a beginner are:

  • Checking out (svn co): This is the first download of the current version of some project from the server.
  • Updating (svn up): This updates your local copy of the code to the current version on the server. If possible, all changes that other users have done are merged into your local copy. If this is not possible (e.g. because the same place has been edited by you or someone else), a conflict occurs which you have to resolve by hand. It's pretty smart, though, so this doesn't happen very often.
  • Commiting (svn commit): With this, you send your local changes to the server for everyone to see.

Checking out the ALPS source

  • get an account (see ALPS2.0) for the svn server. Please note that there are two different ALPS related accounts: ALPS svn accounts and ALPS wiki accounts. The SVN account also works for the new bug-tracking system, trac, which replaces bugzilla. You need to ask us to create a Wiki account. For Subversion, refer to [1]
  • type 'which svn' in your shell to check if you have an svn client on your local machine. If not, install the program. Once you have it, type
mkdir alps_svn
cd alps_svn
svn co --username your_user_name

co stands for checkout. Make sure you type https to get an encrypted connection, and enter your password. If you're familiar with CVS (e.g. because you have used the ALPS cvs before) just use the same commands...

View the ALPS source on the web

We are now using Trac to view the source online, set milestones, keep track of bugs and in general manage the development of ALPS.

Commiting your changes

In order to commit your code changes do the following:

  • Go to the directory where you want to commit the changes, and type
svn update

This will incorporate all changes by other people into your current revision. If there are changes, compile your code again and check if it's still working.

  • Then type
svn diff

svn diff shows you the difference between the current revision on the svn repository and the 'working version' you have on your computer.

  • If you are sure that all the differences between the repository and your local copy make sense, type
svn ci filename -m"this is my log message that describes what I have changed"

Ci stands for commit. This will commit your changes to the repository.

Resolving Conflicts

If you're updating your files and someone else committed a changed version in the mean time, you might get a conflict. Conflicts happen when svn cannot merge the two versions properly.

To resolve the conflict: open your file with the editor and look for the '>>>' and '<<<' signs. Then merge the two versions by hand. Type

svn resolved file

Once you have resolved the conflict, and

svn ci

to check in your changes.

Other useful commands

You can then inspect the results of your changes on the svn repository with websvn, or you can type

svn log filename 

to see the recent changes.

You might also want to inspect the changes between revisions on the command line (instead of the diff environment of svn). In order to do that, type

svn diff -r 2161:2157 abstractspinsim.h

and you will get the same result as above: one line has been added.

Every now and then you'll need to delete a file in the repository. In order to do that, remove the file locally, then type

svn delete filename
svn ci filename

This will mark the file in the repository for deletion and then remove it.