wiki:Doc/Tools/External/SvnBasic

Basic commands to manage source versions: Subversion (svn)

1. How to find help

General help :

svn help

Help for a specific command (e.g. add)

svn help add

2. How to create a workspace from a file repository

In one of your directories, from a file repository identified by a URL:

svn checkout URL directory

3. 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) :

svn status [namefile]

To find out if your file has been modified in its present state :

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

4. 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 :

svn log -rHEAD:BASE

To find out all revisions (version number and message) related to a file ;

svn log [namefile]

This information can be accessed via the related forge with the Timeline tag.

5. How to update your workspace

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.

svn update [namefile]

Example :

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.

6. How to add a svn version identifier in a file header

Add the following line in the file's header :

! $Id$
or according to type of file (shell script, makefile, etc.)
# $Id$

Then type the following command lines :

svn propset svn:keywords "Id" *.f90

This modification will be taken into account in the repository in the next commit of this file.

7. How to add a directory or a file to your workspace

svn add newnamefile

This modification will be taken into account in the repository in the next commit of this file.

8. How to delete a file

svn delete namefile

This modification will be taken into account in the repository in the next commit of this file.

9. 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://...)

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.

10. 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:

svn switch --relocate http://forge.ipsl.fr/igcmg/svn svn+ssh://login@forge.ipsl.fr/ipsl/forge/projets/igcmg/svn
Last modified 5 weeks ago Last modified on 03/13/24 17:07:30