Version 36 (modified by nicolasmartin, 2 years ago) (diff)

Working with SVN and tickets

Last edited at 05/18/20 09:05:57 by smasson

Request write permissions to the repository

First and foremost, if you don't already have a user account then you have to create it.

For NEMO consortium members

If you have a user account or had a developer account before, see with your local NEMO Officer.

Name

Pierre Mathiot

Andrew Coward

Guillaume Samson

Dorotea Iovino

Sebastien Masson

Office

Met_Office

NERC

Mercator_Ocean

CMCC

CNRS

For external users

Submit your contribution to the NEMO System Team by creating a ticket where you will present your proposal.
Keep in mind that, despite the help we can offer, a certain amount of work from you will be need to implement your developments into the source code.

Document your developments before coding

Follow the procedure described at wiki:Developers/DevelopingCodeChanges

Howtos with SVN

Create a new routine

Use the template source:trunk/NEMOGCM/NEMO/OPA_SRC/module_example
If not don't forget to set the SVN property of the routine in order to get the functionality of SVN Id keyword replacement

svn propset svn:keywords Id New_routine.f90

Branch

For branch naming conventions, see wiki:Developers/DevelopingCodeChanges

svn copy svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk                  \ 
         svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/dev_r1720_SBC \
         -m 'Create a specific branch for the New Surface Module'

For development branches, we tend to add one level of subdirectory corresponding to the current year, and an additional item in the name corresponding to the work-plan,for instance:

svn copy svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk                               \
         svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2011/dev_r1720_LOCEAN1_mpp \
         -m 'Create a specific branch for mpp evolution'

Commit

Extract with svn+http protocol or see section 'Switch from user to developer'.

svn co svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/dev_001_SBC

Commit message

Recommended syntax to be added in the commit message

  • If the commit is related to one or several tickets, we highly suggest to add the commit message as ticket comment.
    To do so, you can use one of the word in the list addresses re references refs see followed by usual ticket link(s).
    Ex: see #1948 somewhere in the commit message to link with #1948
  • If the commit is a fix for one or several tickets, you can close them with the commit.
    To do so, you can use one of the word in the list close closed closes fix fixed fixes followed by usual ticket link(s).
    Ex: fix #1948 somewhere in the commit message to close #1948 without a browser.

Be careful if you mix the 2.

Then in the appropriate directory

# Commit and write the log message (ticket link #.... and so on) in your editor
svn ci files_list
# `svn ci` without files list will commit all modified files recursively from the current directory
# or directly from the command line of the shell session
svn ci -m 'log_message' files_list
# Tip: set your editor for SVN for multi-lines commit message
# for sh  and other related shells, interesting to include it in ~/.profile or ~/.bash_profile)
export SVN_EDITOR='your_favourite_editor' 
# for csh  "    "      "      ""  ,      "      ""    "    "" "" ~/.login                     )
setenv SVN_EDITOR='your_favourite_editor'

Tag

svn copy svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk          \
         svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/tags/nemo_v2_3 \
         -m "Tagging nemo_v2_3"

Merge

To get all changes from the revision 746 to the current one (HEAD) on a specific directory

# (you have already downloaded the branch you are working on)
cd ./NEMO/OPA_SRC/IOM
svn merge -r 746:HEAD -m 'Merge my local IOM directory with the trunk repository'                               \
          svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk/NEMO/OPA_SRC/IOM \

Update of a file between branches

Suppose the downloaded NEMO directory corresponds to the tag nemo_v3 (i.e. from http://forge.ipsl.jussieu.fr/nemo/svn/tags/nemo_v3/NEMO); the current revision number of the file sbcssm.F90 is 1196. To get the new revision (which has been committed on the trunk http://forge.ipsl.jussieu.fr/nemo/svn/trunk/NEMO ) with the revision number 1214:

cd ./modeles/NEMO/OPA_SRC/SBC/
svn merge -r 1196:1214 http://forge.ipsl.jussieu.fr/nemo/svn/trunk/NEMO/OPA_SRC/SBC/sbcssm.F90

Information about the sources

To get information such as the PATH/URL you are working on, .i.e. trunk, branches .. and so on

cd ./NEMO && svn info

To get all commits/revision performed/associated on/to your working repository since its creation

cd ./NEMO && svn log --verbose --stop-on-copy

Switch from user to developer

The following command is set for the trunk, adapt as required for your developing branch.

svn switch --relocate    http://forge.ipsl.jussieu.fr                                       \
                      svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets

Switch from a branch to the trunk

Your working copy was based on a given branch which has been moved to the trunk.

svn switch http://forge.ipsl.jussieu.fr/nemo/svn/trunk/NEMOGCM

Comments: takes some time and asks if conflicts

Delete a branch

svn del svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2016/dev_rxxx_branch_name \
        --message 'Delete defunct branch'