Changes between Version 37 and Version 38 of Developers/SVN_QuickReference
- Timestamp:
- 2018-06-05T00:58:06+02:00 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Developers/SVN_QuickReference
v37 v38 1 = '''Working with SVN'''1 = SubVersioN basics 2 2 3 3 [[PageOutline(2-3)]] … … 5 5 Last edited at '''[[Wikinfo(changed_ts)]]''' by '''[[Wikinfo(changed_by)]]''' 6 6 7 == '''Howtos with SVN''' 7 {{{#!box type=note 8 Here 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 }}} 8 10 9 == = Create a new routine11 == Branching 10 12 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 15 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 13 16 14 17 {{{#!sh 15 svn propset svn:keywords Id New_routine.f9018 svn copy trunk branches/'Current_year'/'Name_of_the_new_branch' 16 19 }}} 17 20 18 === Branch 21 For branch naming conventions, see [wiki:Developers/DevelopingCodeChanges]. 19 22 20 For branch naming conventions, see wiki:Developers/DevelopingCodeChanges 23 === Switch to the trunk (hazardous) 24 25 Your working copy was based on a given branch which has been moved to the trunk (conflicts unavoidable and pretty complicated to resolve). 21 26 22 27 {{{#!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' 28 svn switch http://forge.ipsl.jussieu.fr/nemo/svn/NEMO/trunk 26 29 }}} 27 30 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 29 32 30 33 {{{#!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' 34 svn del 'Path/to/the/branch/to/delete' 34 35 }}} 35 36 36 == = Commit37 == Manage versioned items (file / folder) 37 38 38 Extract with `svn+http` protocol or see section '[#Switchfromusertodeveloper Switch from user to developer]'. 39 === Add a new NEMO routine 40 41 Use the template from [source:/NEMO/trunk/src/OCE/module_example] 39 42 40 43 {{{#!sh 41 svn co svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/dev_001_SBC44 svn copy trunk/src/OCE/module_example branches/'Current_year'/'dev_branch'/'path/to/the'/new_routine.f90 42 45 }}} 43 46 44 ==== Commit message #commitmessage 47 If 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 45 48 46 {{{#!div class="notice system-message" 49 {{{#!sh 50 svn pset svn:keywords Id 'path/to/the'/new_routine.f90 51 }}} 52 53 === Add a new file / Remove a file 54 55 {{{#!sh 56 svn add 57 svn del 58 }}} 59 60 === Update file between branches 61 62 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: 63 64 {{{#!sh 65 cd ./modeles/NEMO/OPA_SRC/SBC/ 66 svn merge -r 1196:1214 http://forge.ipsl.jussieu.fr/nemo/svn/trunk/NEMO/OPA_SRC/SBC/sbcssm.F90 67 }}} 68 69 == Merging 70 71 To 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) 75 cd ./NEMO/OPA_SRC/IOM 76 svn 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 83 svn co [-m 'log message in one line'] items 84 }}} 85 86 {{{#!box type=tips 47 87 48 88 __Recommended syntax to be added in the commit message__ … … 77 117 }}} 78 118 79 === Tag80 81 {{{#!sh82 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 === Merge88 89 To get all changes from the revision 746 to the current one (HEAD) on a specific directory90 91 {{{#!sh92 # (you have already downloaded the branch you are working on)93 cd ./NEMO/OPA_SRC/IOM94 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 branches99 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 {{{#!sh103 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.F90105 }}}106 107 119 === Information about the sources 108 120 … … 118 130 cd ./NEMO && svn log --verbose --stop-on-copy 119 131 }}} 120 121 === Switch from user to developer122 123 The following command is set for the trunk, adapt as required for your developing branch.124 125 {{{#!sh126 svn switch --relocate http://forge.ipsl.jussieu.fr \127 svn+ssh://'your_forge_login'@forge.ipsl.jussieu.fr/ipsl/forge/projets128 }}}129 130 === Switch from a branch to the trunk131 132 Your working copy was based on a given branch which has been moved to the trunk.133 134 {{{#!sh135 svn switch http://forge.ipsl.jussieu.fr/nemo/svn/trunk/NEMOGCM136 }}}137 138 Comments: takes some time and asks if conflicts139 140 === Delete a branch141 142 {{{#!sh143 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 }}}