wiki:svn

Version 13 (modified by trac, 12 years ago) ( diff )

SVN User's Reference

Note: The utility BearToChombo is not in the SVN repository. It is, however, attached to the end of this page.

(This page is based on the old user's reference made by Kris Yirak, http://www.pas.rochester.edu/~yirak/svn.)

The commands and descriptions given here are presented approximately in the order in which a user is expected to need them. This is why Checking In is discussed much later than Checking Out. Optional arguments are given in [square brackets].

Note: for all of the commands below, it is assumed you are operating in the base directory for a given module. I.e., if you're going to check-out something to the "bearclaw_revision_173" directory, it is assumed you've made the directory and are currently sitting in it.

Checking Out

To check-out a copy of the code, use the svn co command:

  • AstroBear: svn co svn+ssh://[username]@clover.pas.rochester.edu/var/repositories/astrobear/dev astrobear
  • Bear2fix svn co svn+ssh://[username]@clover.pas.rochester.edu/var/repositories/bear2fix/dev bear2fix
  • Documentation (outdated): svn co svn+ssh://[username]@clover.pas.rochester.edu/var/repositories/doc

These commands will check-out the most recent version of the code to the current directory. A different directory may be supplied as an optional argument.

After this initial check-out, you only need to update this working version (see below) rather than check-out again.

You may also check-out a revision other than the current one, via

 svn co -r N https://[path] [optional_directory]

where N is any number from 1 to the current revision number and [path] stands for one of the repository paths above.

Browsing the Repository

Bearclaw/astroBEAR

To navigate the repository (see the line-by-line, fancy color-denoted changes between revisions, etc.), use Trac's Source Browser at the top of every Wiki page.

bear2fix

The post-processing tool bear2fix also has a Source Browser.

Querying the Working Copy Version

To quickly find out the revision number of the working copy,

 svn info

Working Copy Changes

To see what files you've made changes to/left alone/deleted/etc. from the version which you checked out (not versus the current version; see discussion of svn st -u below),

 svn st -v

returns a verbose list of files and flags:

Flag Interpretation
? File is not part of SVN—see how to add files below.
! File is missing or incomplete (moved/deleted without involving SVN)
M File has been modified by you.
File is the same as when it was checked out.

SVN Quick Reference Card

For other symbols, and a list of SVN commands with short descriptions, please see the SVN Reference Card (SVN mirror).

To see if your copy of the code is up to date/to see how your modifications compare to the current repository version,

 svn st -u

returns the "up-to-date?" status for your files.

Note that this command, as well as most others, may be performed on the entire working copy structure (as in the above) or on a single file, e.g.

 svn st -u arf.f90

will tell you whether arf.f90 is up to date versus the most recent revision. Note also that if you delete a directory with (svn rm {directory} ) or without (rm {directory} ) involving SVN, doing svn st -u will list every file in that directory, pointing out that each has been deleted. To avoid this, you may do

 svn st -uq

to have it quietly list changes. In the case of deleting a directory, it will list only that it has been deleted, without detailing the deletion of each file.

Adding/ Moving/ Deleting Files in SVN

If you plan on committing any change other than modifying an existing file — moving files, deleting files, adding files, etc. — you must do the changes within SVN in order for it to recognize them. This involves simply prepending the usual command with svn, e.g.

 svn rm arf.f90

will remove arf.f90 within SVN's structure so that when you check-in, that file will no longer exist in the revision. If you simply rm arf.f90, when you check-in it will allow the check-in, ignoring the fact that that file mysteriously disappeared and keeping arf.f90 in the revision. Similarly, as mentioned above, if you subsequently do an update, it will restore arf.f90 to your working copy.

Updating the Working Copy

To make your working copy up-to-date to the most recent version of the code,

 svn up

This will cleanly update only files you have not modified, though it will also add back files you've non-SVN'ly deleted (see above). However, it will attempt to merge files you've modified, and most likely will stop and tell you about any conflict.

Checking In

To commit/check-in changes in your working copy,

 svn ci [-m "A short check-in message."]

Typically, only a short message is required when checking-in something to the repository. These can be passed with the -m argument, in quotes, e.g. "Fixed _ module." If the environmental variable $EDITOR or $SVN_EDITOR is set (e.g., in ~/.bashrc, set export SVN_EDITOR=nano), typing simply svn ci will allow you to give more complicated details in the text editor of your choice.

If you attempt to commit an out-of-date working copy, SVN will not do it and will tell you you're out of date. At this point, you must either update your working copy (svn up) or (more dangerously) commit only specific files that have been modified, e.g.

 svn ci problem.f90 arf/arf.f90 -m "Fixed arf module."

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.