{{{ #!html

Basic commands to manage source versions: Subversion (svn)

}}} [[PageOutline]] ## How to find help ## General help : {{{ #!sh svn help }}} Help for a specific command (e.g. {{{add}}}) {{{ #!sh svn help add }}} ## How to create a workspace from a file repository ## In one of your directories, from a file repository identified by a URL: {{{ #!sh svn checkout URL directory }}} ## How to find out about your workspace's status ## To find out if a file has been modified since your last update ({{{checkout}}} or {{{update}}}) : {{{ #!sh svn status [namefile] }}} To find out if your file has been modified in its present state : {{{ #!sh svn status -u [namefile] }}} If a file's content has been modified, this will be shown in the 1st column. If a file's property has been modified, this will be shown in the 2nd column. A:: the file has been added in your workspace. It does not exist in the file repository. D:: the file has been deleted from your directory. It still exists in the file repository. M:: the file has been modified in your workspace. It is different than the file in the repository ## How to find out the repository's status ## If you want to find out the changes that have been made in the svn sources repository : {{{ #!sh svn log -rHEAD:BASE }}} To find out all revisions (version number and message) related to a file ; {{{ #!sh svn log [namefile] }}} This information can be accessed via the related [wiki:DocKexterntools#forge forge] with the `Timeline` tag. ## How to update your workspace ## [[NoteBox(warn, It is not recommended to update your workspace unless you have previously spoken with the persons in charge of each model components\, configurations or tools.)]] {{{ #!sh svn update [namefile] }}} Example : {{{ #!sh svn update toto U toto }}} The '''svn update''' command returns a letter (U, A, D, R, G or C) and the file name concerned. Below is the meaning of these letters : U:: The file has been updated properly. There is no conflict. A:: The file has been added to your directory, it did not exist before. D:: The file has been deleted from your directory. R:: The file has been replaced in your directory. G:: You have changed the original file and these changes are not in conflict with the update. C:: There are conflicts between the update and you own changes. You must therefore open the file and solve the problems by hand. ## How to add a svn version identifier in a file header ## Add the following line in the file's header : {{{! $Id$}}} [[BR]] or according to type of file (shell script, makefile, etc.) [[BR]] {{{# $Id$}}} Then type the following command lines : {{{ #!sh svn propset svn:keywords "Id" *.f90 }}} This modification will be taken into account in the repository in the next [#Propagerlesmodificationsdesonespacedetravailaudépôt "commit"] of this file. ## How to add a directory or a file to your workspace ## {{{ #!sh svn add newnamefile }}} This modification will be taken into account in the repository in the next [#Propagerlesmodificationsdesonespacedetravailaudépôt "commit"] of this file. ## How to delete a file ## {{{ #!sh svn delete namefile }}} This modification will be taken into account in the repository in the next [#Propagerlesmodificationsdesonespacedetravailaudépôt "commit"] of this file. ## How to propagate the changes from your workspace to the repository ## '''This is only possible if the repository has been retrieved as administrator with ({{{svn checkout svn+ssh://...}}}) ''' {{{ #!sh svn commit --message "explication modification" [namefile] }}} If {{{namefile}}} does not appear in the command, all modified ({{{M}}}), added ({{{A}}}) or deleted ({{{D}}}) files in the current workspace will be taken into account. Files identified by the sign {{{!}}} and {{{?}}} by {{{svn status}}} will not be taken into account. ## How to change the status of a version retrieved with svn ## If you retrieved a model in read-only mode ({{{svn export ...}}}) and if you want to perform a "commit" on it, you can change the status of this version. Here is an example with igcmg: {{{ #!sh svn switch --relocate http://forge.ipsl.jussieu.fr/igcmg/svn svn+ssh://login@forge.ipsl.jussieu.fr/ipsl/forge/projets/igcmg/svn }}}