Changes between Version 37 and Version 38 of Developers/SVN_Quick Reference


Ignore:
Timestamp:
2018-06-05T00:58:06+02:00 (2 years ago)
Author:
nicolasmartin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Developers/SVN_Quick Reference

    v37 v38  
    1 = '''Working with SVN''' 
     1= SubVersioN basics 
    22 
    33[[PageOutline(2-3)]] 
     
    55Last edited at '''[[Wikinfo(changed_ts)]]''' by '''[[Wikinfo(changed_by)]]''' 
    66 
    7 == '''Howtos with SVN''' 
     7{{{#!box type=note 
     8Here we assumed that you are working locally with the default development organisation of the NEMO reference (trunk + branches + releases in your working directory), if not browse to [wiki:Developers#Recommendeddevelopmentinstallation Developers homepage] 
     9}}} 
    810 
    9 === Create a new routine 
     11== Branching 
    1012 
    11 Use the template source:trunk/NEMOGCM/NEMO/OPA_SRC/module_example \\ 
    12 If not don't forget to set the SVN property of the routine in order to get the functionality of SVN Id keyword replacement 
     13=== Create a branch 
     14 
     15For 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 
    1316 
    1417{{{#!sh 
    15 svn propset svn:keywords Id New_routine.f90 
     18svn copy trunk branches/'Current_year'/'Name_of_the_new_branch' 
    1619}}} 
    1720 
    18 === Branch 
     21For branch naming conventions, see [wiki:Developers/DevelopingCodeChanges]. 
    1922 
    20 For branch naming conventions, see wiki:Developers/DevelopingCodeChanges 
     23=== Switch to the trunk (hazardous) 
     24 
     25Your working copy was based on a given branch which has been moved to the trunk (conflicts unavoidable and pretty complicated to resolve). 
    2126 
    2227{{{#!sh 
    23 svn copy svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk                  \  
    24          svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/dev_r1720_SBC \ 
    25          -m 'Create a specific branch for the New Surface Module' 
     28svn switch http://forge.ipsl.jussieu.fr/nemo/svn/NEMO/trunk 
    2629}}} 
    2730 
    28 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: 
     31=== Delete a branch 
    2932 
    3033{{{#!sh 
    31 svn copy svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk                               \ 
    32          svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2011/dev_r1720_LOCEAN1_mpp \ 
    33          -m 'Create a specific branch for mpp evolution' 
     34svn del 'Path/to/the/branch/to/delete' 
    3435}}} 
    3536 
    36 === Commit 
     37== Manage versioned items (file / folder) 
    3738 
    38 Extract with `svn+http` protocol or see section '[#Switchfromusertodeveloper Switch from user to developer]'. 
     39=== Add a new NEMO routine 
     40 
     41Use the template from [source:/NEMO/trunk/src/OCE/module_example] 
    3942 
    4043{{{#!sh 
    41 svn co svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/dev_001_SBC 
     44svn copy trunk/src/OCE/module_example branches/'Current_year'/'dev_branch'/'path/to/the'/new_routine.f90 
    4245}}} 
    4346 
    44 ==== Commit message #commitmessage 
     47If the `svn:keywords` property is not defined, don't forget to set it in order to get the functionality of `$Id` keyword replacement with the commit informations 
    4548 
    46 {{{#!div class="notice system-message" 
     49{{{#!sh 
     50svn pset svn:keywords Id 'path/to/the'/new_routine.f90 
     51}}} 
     52 
     53=== Add a new file / Remove a file 
     54 
     55{{{#!sh 
     56svn add  
     57svn del  
     58}}} 
     59 
     60=== Update file between branches 
     61 
     62Suppose 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: 
     63 
     64{{{#!sh 
     65cd ./modeles/NEMO/OPA_SRC/SBC/ 
     66svn merge -r 1196:1214 http://forge.ipsl.jussieu.fr/nemo/svn/trunk/NEMO/OPA_SRC/SBC/sbcssm.F90 
     67}}} 
     68 
     69== Merging 
     70 
     71To get all changes from the revision 746 to the current one (HEAD) on a specific directory 
     72 
     73{{{#!sh 
     74# (you have already downloaded the branch you are working on) 
     75cd ./NEMO/OPA_SRC/IOM 
     76svn merge -r 746:HEAD -m 'Merge my local IOM directory with the trunk repository'                               \ 
     77          svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk/NEMO/OPA_SRC/IOM \ 
     78}}} 
     79 
     80== Commit changes to the repository 
     81 
     82{{{#!sh 
     83svn co [-m 'log message in one line'] items 
     84}}} 
     85 
     86{{{#!box type=tips 
    4787 
    4888__Recommended syntax to be added in the commit message__ 
     
    77117}}} 
    78118 
    79 === Tag 
    80  
    81 {{{#!sh 
    82 svn copy svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk          \ 
    83          svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/tags/nemo_v2_3 \ 
    84          -m "Tagging nemo_v2_3" 
    85 }}} 
    86  
    87 === Merge 
    88  
    89 To get all changes from the revision 746 to the current one (HEAD) on a specific directory 
    90  
    91 {{{#!sh 
    92 # (you have already downloaded the branch you are working on) 
    93 cd ./NEMO/OPA_SRC/IOM 
    94 svn merge -r 746:HEAD -m 'Merge my local IOM directory with the trunk repository'                               \ 
    95           svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk/NEMO/OPA_SRC/IOM \ 
    96 }}} 
    97  
    98 === Update of a file between branches 
    99  
    100 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: 
    101  
    102 {{{#!sh 
    103 cd ./modeles/NEMO/OPA_SRC/SBC/ 
    104 svn merge -r 1196:1214 http://forge.ipsl.jussieu.fr/nemo/svn/trunk/NEMO/OPA_SRC/SBC/sbcssm.F90 
    105 }}} 
    106  
    107119=== Information about the sources 
    108120 
     
    118130cd ./NEMO && svn log --verbose --stop-on-copy 
    119131}}} 
    120  
    121 === Switch from user to developer 
    122  
    123 The following command is set for the trunk, adapt as required for your developing branch. 
    124  
    125 {{{#!sh 
    126 svn switch --relocate    http://forge.ipsl.jussieu.fr                                       \ 
    127                       svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets 
    128 }}} 
    129  
    130 === Switch from a branch to the trunk 
    131  
    132 Your working copy was based on a given branch which has been moved to the trunk. 
    133  
    134 {{{#!sh 
    135 svn switch http://forge.ipsl.jussieu.fr/nemo/svn/trunk/NEMOGCM 
    136 }}} 
    137  
    138 Comments: takes some time and asks if conflicts 
    139  
    140 === Delete a branch 
    141  
    142 {{{#!sh 
    143 svn del svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2016/dev_rxxx_branch_name \ 
    144         --message 'Delete defunct branch' 
    145 }}}