ALPS subversion for dummies

From ALPS Algorithms and Libraries for Physics Simulations

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.

Contents

[edit] Checking out the ALPS source

  • get an account (see ALPS2.0) for the svn server. Please note that there are three different ALPS related accounts: ALPS svn accounts, ALPS wiki accounts, and ALPS bugzilla accounts. You can create your bugzilla account yourself (alps.comp-phys.org/bugzilla), but you will need to ask us to create a Wiki and svn account for you.
  • 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 https://alps.comp-phys.org/svn/alps1/trunk/alps
svn co --username your_user_name https://alps.comp-phys.org/svn/alps1/trunk/applications

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...

[edit] View the ALPS source on the web

We have a very nice websvn interface where you can easily inspect the ALPS source. There you can also view the changes that we have commited over time. to have a first look, go to

https://alps.comp-phys.org/websvn/

Now, say you want to see what happened to the classical spin code recently. It used to work, but two weeks ago someone updated the code and now it's broken! First, go to the spin code (which is the 'mc' code in the applications):

Click on alps1
Click on trunk (trunk is where the changes are commited if they don't end up 
in one of the branches... above, you checked out the 'trunk').
Click on applications
Click on mc
Click on spins

Now go to the right side, and click on 'view log'. A page appears where you can inspect the log messages of recent changes. When you check in your changes, you should always write a short note describing these changes.

Let's assume that the problem is caused by revision 2161, commited by gullc (Emanuel). Let's compare the difference between revision 2157 and 2161: click on the two versions and then on 'Compare revisions' at the bottom, and you see in green that one line has been added: the general_case_(false).

[edit] 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.

[edit] 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.

[edit] 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.

Personal tools