De Wiki de Calcul Québec
Aller à : Navigation, rechercher
Cette page est une traduction de la page SVN et la traduction est complétée à 100 % et à jour.

Autres langues :anglais 100% • ‎français 100%

Subversion (or svn) is a source code manager. It helps managing multiple versions of a software that is evolving.


General Principles

Subversion, like CVS, uses a unique, centralized repository, where are stored all versions of the files of a project. Subversion is different from CVS through its versionning numbers that are global, rather than per file. Subversion also permits to rename or move a file without loosing its history.

The subversion repository can be located within a local directory or on a remote server.

Similar Commands Between CVS and SVN

  • cvs checkout => svn checkout (co)
 Usage : svn checkout URL[@REV] ... [LOCAL_PATH]
 Useful option(s) :
      --revision (-r)
      --non-recursive (-N)
  • cvs add => svn add
 Usage : svn add PATH ...
 Useful option(s) :
      --non-recursive (-N)
  • cvs commit => svn commit (ci)
 Usage : svn commit [LOCAL_PATH ...]
 Useful option(s) :
      --message (-m) TEXT
      --non-recursive (-N)
  • cvs update => svn update (up)
 Usage : svn update [LOCAL_PATH ...]
 Useful option(s) :
      --non-recursive (-N)
  • cvs remove => svn delete (del, remove, rm)
 Usage : svn delete LOCAL_PATH... or URL ...
 Useful option(s) :
      --message (-m) TEXT

Note : in the case of a LOCAL_PATH, you will have to run svn commit in order to propagate the delete operation to the repository. In the case of a URL, the operation is directly applied to the repository.

Exclusive Commands to Subversion

  • svn blame (praise, annotate, ann)
 Description : For a given target, show the revision number, the author and the message of all modifications.
 Usage : svn blame TARGET[@REV] ...
 Useful option(s) :
       --revision (-r) REV
  • svn cat
 Description : Shows the content of files or URLs
 Format : 	svn cat CIBLE[@REV] ...
 Useful options :
       --revision (-r) REV
  • svn copy (cp)
 Description : Copy or branch from a file or directory. The new copy inherits the historic of the source.
 Usage : svn copy SRC DST
 SRC and DST are either a path to a local directory or file (LC) or a URL :
   LC  -> LC  : copy with historic (waiting for commit)
   LC  -> URL : immediate copy or branch creation to the repository
   URL -> LC  : local branch from the repository (waiting for commit)
   URL -> URL : immediate branch or tag creation on the server side
 Options utiles :
       --message (-m) TEXT
  • svn import
 Description : Imports a non-versioned file or directory into the repository.
 Usage : svn import [LOCAL_PATH] URL
 Useful option(s) :
      --message -(-m) TEXT

Note : if you want to import a complete directory, make sure the URL contains the name of the local directory. Subversion will NOT automatically append the local directory's name to the URL. For example:

 svn import ./project1 https://server/path/to/repos/project1
  • svn info
 Description : Show some information about local or remote targets
 Usage : svn info [TARGET[@REV] ...]
 Useful option(s) :
       --recursive (-R)
  • svn list
 Description : List the versioned content of a directory
 Usage : svn list [TARGET[@REV] ...]
 Useful option(s) :
       --revision (-r) REV
       --verbose (-v)
       --recursive (-R)
  • svn log
 Description : Show the log entries for a set of revisions or files.
 Usage : svn log [PATH] or URL
 Useful option(s) :
       --revision (-r) REV
       --verbose (-v)
  • svn mkdir
 Description : Creates a new versioned directory. In a working directory, you still have to
   commit the addition. In the repository, the addition is commited at the same time.
 Usage : svn mkdir PATH or URL
 Useful option(s) :
       --message (-m) TEXT
  • svn move (mv, rename, ren)
 Description : Moves or renames a target. In the working directory, you still have to commit the
   modification. In the repository, the commit is done immediately.
 Usage : svn move SRC DEST
 Useful option(s) :
       --message (-m) TEXT
  • svn status (stat, st)
 Description : Show the state of files and directories in a working copy of a versioned directory.
 Usage : svn status [LOCAL_PATH ...]
 Useful option(s) :
       --show-updates (-u)
       --verbose (-v)
       --non-recursive (-N)
 Comments : the first column show the state of the object
       ' ' no modification
       'A' added
       'C' in conflict
       'D' deleted
       'I' ignored
       'M' modified
       'R' replaced
       'X' non versioned, but used by an external reference
       '?' non versioned
       '!' missing (deleted without 'svn rm') or incomplete
       '~' versioned object replaced with a different object
 The second column shows the state of properties of the file or directory
       ' ' no modification
       'C' in conflict
       'M' modified
 The third column is only used when the working copy is locked
       ' ' non locked
       'L' locked
 The fourth column is used when an object is added or moved with some history
       ' ' added without historic
       '+' added with historic

Subversion Clients


The complete documentation of Subversion can be found in the online book Version Control with Subversion.

Outils personnels
Espaces de noms

Ressources de Calcul Québec