WorkingOnServers/UsingSVN

From mn/geo/geoit
(Redirected from Shell/UsingSVN)
Jump to: navigation, search

<rst>

    • SVN short summary**

Here is how to use the SVN current versions system for the FLEXPART code from the command line. There are also graphical frontends for all operating systems, which may make life a bit more colorful.

In August 2011 the SVN server changed from embla.nilu.no to svn.nilu.no in order to use the new repository you have to issue following command:

  svn switch --relocate svn://embla.nilu.no/FLEXPART/trunk/FLEXPART svn://svn.nilu.no/FLEXPART/trunk/FLEXPART 'sandbox'

This is a very useful documentation:

   http://svnbook.red-bean.com/en/1.5/index.html
     

Some definitions:

 'repository': this is the location on the version server where the common code is stored
 'sandbox' : this is your local copy of the source code, 
 'checkout': copy a version of the code from the repository to your local directory
 'commit': submit a revised version of the code to the repository

To get help

 - type 'svn help' to get all commands
 - type 'svn help <command>' to get help on a specific command

To create a local sandbox (a checked-out version of the code):

 - cd to the directory where you want to create the sandbox
 - type 'svn co svn://embla.nilu.no/FLEXPART'
 - enter username and password if required

In your local directory, a folder structure is created a the new folder FLEXPART. The current main version is in the subfolder 'trunk/FLEXPART'. This is your sandbox. Play around, here you should make your edits and compile as normal. Note: Do not modify the directory structure.

To get information about the repository and your current version

 - cd to your sandbox
 - type 'svn info'

To see changes between a local file and the repository

 - cd to your sandbox
 - type 'svn diff <file>'

To get information about who made changes to a file in the repository, at which revision

 - cd to your sandbox
 - type 'svn blame <file>'

To update to a newer version from the repository

 - cd to your sandbox
 - type 'svn up' (or 'svn update')

If you made local changes to a file which has a newer version in the repository, a warning will be displayed, your local modified files will be renamed, and you will get copies of both the previous and current version of the files in the repository.

To commit changed files to the repository

 - cd to your sandbox
 - type 'svn ci <file>' (or 'svn checkin' or is it 'commit'

Your favourite editor will open (defined by the EDITOR system variable). Write a comment according to the following rules:

To tag a version

  svn cp svn://svn.nilu.no/FLEXPART/trunk/FLEXPART  svn://svn.nilu.no/FLEXPART/tags/FLEXPART83_sent_to_CH
 - for bugfixes, write
   BUGFIX: <the bug you killed>
 - for new features, write
   ADD: <the feature you added>
 - for modified features, write
   MOD: <the feature you modified>
 - for things you deleted, write
   DEL: <the feature you deleted>

When you save and quit the editor, the new file will be committed to the repository. If you quit without writing a comment, you can cancel the committing process.

If you try to commit a file which has been updated to a newer version since you checked out last, a warning will be displayed and the file will not be commited. Always make a checkout before making a commit. There is also the option to lock a file for some time, read the documentation ('svn help lock') for this feature. Don't forget to unlock afterwards.

To add a new file to the repository

 - cd to your sandbox
 - type 'svn add <file>'
 - type 'svn ci <file>' (or svn commit)

For using branches and tags use the copy command

 - cd to your sandbox 
 - type 'svn copy trunk/FLEXPART branches/FLEXPART_branch
 -or-
 - type 'svn copy trunk/FLEXPART tags/FLEXPART_tag

Comparing different versions

 - to see all log files related to one source file 
 - svn log timemanager.f
 - to compare the source of 2 different versions
 - svn diff timemanager.f --revision 133 (revision 133 with the local version)
 - svn diff timemanager.f --revision 126:133 (revision 126 wtih revision 133)


For further info, please refer to the documentation using 'svn help'

</rst>