SVN Repository Information and Tips

From NUTMEGwiki

Jump to: navigation, search

SVN Setup (Developers and UCSF users only)

You will need to e-mail Sarang or Johanna with a copy of your SSH public key (located in ~/.ssh/id_rsa.pub of the computer you will be using). If it does not already exist, you need to run:

ssh-keygen -t rsa

If you have a copy of NUTMEG that was checked out via SVN before SSH was implemented (roughly March 2009), you can convert your existing copy to use svn+ssh. On your local SVN copy of nutmeg, edit the first two lines of the .svn/entries file in the nutmeg directory AND all subdirectories to say:

svn+ssh://nutmeg@ocf.berkeley.edu/nutmeg[/subdir/subdir]
svn+ssh://nutmeg@ocf.berkeley.edu/nutmeg

[of course replacing "subdir" with whatever subdirectory was originally named there.]

Alternatively, you can recheckout and manually replace any files that you have changed but not yet committed...

Otherwise, if you are checking out for the first time, after Sarang/Johanna creates your account run the following command -- assuming a Linux or Mac command line:

svn co svn+ssh://nutmeg@ocf.berkeley.edu/nutmeg/trunk destinationdir

"destinationdir" is the directory you want to create to hold all the code, e.g., simply "nutmeg" or "nutmegsvn" would do. (I'm not sure what it does to existing directories, so, to be safe, you should rename old directories or choose a new directory name.) If all goes well, it should ask you for a password and download everything. I will send out usernames and passwords separately; let me know if you need one and haven't gotten an e-mail from me.

If you want to try on Windows, TortoiseSVN is the recommended client. It should be relatively intuitive to find the TortoiseSVN equivalent to all the above commands.

In Matlab, be sure to add the created nutmeg directory to your path (including subdirectories). Also, you will need to add SPM2 to your path: /netopt/share/lib/matlab/spm2 + subdirectories.

It is highly recommended that you make some changes to spm_defaults.m and place it in your /home/user/matlab directory. (Be sure this directory is above nutmeg and spm in the path list.) You may copy Sarang's version from /data/research_meg/tfbf/examples/spm_default.m. This version sets the default MRI format to neurological orientation (i.e., left on left and right on right) and expands the spatial normalization bounds to include all of the cerebellum.

Since we are actively fixing bugs and developing new features, you should periodically update your checked out copy of NUTMEG. To do that, change into the directory that contains nutmeg and run svn update.

Common SVN Commands

To download new updates from the repository:

svn update

To contribute bug fixes or other updates to existing code, you "commit" the file just like with CVS:

svn commit whatever.m -m 'my sweet new feature'

To add a completely new file or directory:

svn add nut_myawesomecode.m

To see a list of files with uncommitted changes or new versions available from the repository:

svn status

To see exactly what's different in your local file compared to the repository:

svn diff whatever.m

To roll back to a previous version for your local copy of NUTMEG:

svn log | more
or
svn log filename.m | more

Look at the logs to find out which revision number you want to roll back to. Then

svn update -r revisionnumber
or
svn update -r revisionnumber filename.m

To remove a bad commit:

svn update messedupfile.m
svn log messedupfile.m | more

Look at the logs to find out which revision number you want to roll back to. Then

svn merge messedupfile.m@HEAD messedupfile.m@revisionnumber

It should be relatively intuitive to find the TortoiseSVN equivalent to all the above commands.