Difference between revisions of "Subversion (svn)"
Albensoeder (talk | contribs) |
Albensoeder (talk | contribs) |
||
Line 1: | Line 1: | ||
Subversion (svn) is a revision system to track changes of files, e.g. source code of a software. The system based on a subversion server where the so called repository is stored. Users with access to the repository can download (checkout) a copy (working copy) of the reposity to make changes on the code locally. If the changes suitable and tested the changes can be submitted (checkin) to the central repository so that other users have access to the changes. If other users make changes on the repository subversion tries to merge the changes from different users. | Subversion (svn) is a revision system to track changes of files, e.g. source code of a software. The system based on a subversion server where the so called repository is stored. Users with access to the repository can download (checkout) a copy (working copy) of the reposity to make changes on the code locally. If the changes suitable and tested the changes can be submitted (checkin) to the central repository so that other users have access to the changes. If other users make changes on the repository subversion tries to merge the changes from different users. | ||
In the | In the following some basic commands for using svn are listed. | ||
== Environment == | == Environment == |
Latest revision as of 15:01, 26 November 2012
Subversion (svn) is a revision system to track changes of files, e.g. source code of a software. The system based on a subversion server where the so called repository is stored. Users with access to the repository can download (checkout) a copy (working copy) of the reposity to make changes on the code locally. If the changes suitable and tested the changes can be submitted (checkin) to the central repository so that other users have access to the changes. If other users make changes on the repository subversion tries to merge the changes from different users.
In the following some basic commands for using svn are listed.
Environment
Choice od an editor
To set a default editor set the environment variable to the favorite editor, e.g.
export EDITOR=/usr/bin/nedit
set general properties of new files
After a first checkout of a repository a folder ~/.subversion is created. In the file ~/.subversion/config you can set default properties for new files which are added to the repository. To this, add to ~/.subversion/config
enable-auto-props = yes
The properties can bet set in this file by adding a section [auto-props] and a list of properties for defined suffixes, e.g.
[auto-props] *.py = svn:eol-style=native; svn:keywords="Author Date HeadURL Id Rev URL"; svn:executable *.c = svn:eol-style=native; svn:keywords="Author Date HeadURL Id Rev URL" *.h = svn:eol-style=native; svn:keywords="Author Date HeadURL Id Rev URL"
for defining python files as executables and set automatically the svn keywords in *.c, *.h and *.py files, herr the variables $HeadURL:$, $Rev:$', $Author:$ and $Date:$.
Basic commands
Download the content of a repository
svn checkout svn://ServerName/RepositoryName
Submit/checkin a change from a working directory to the repository
svn ci [filenames] [directories]
submit afiles or directories (including subdirectories to the repository. The command opens an editor (default vi) for the changes you've made.
Update of the working dir for the newest version of files or directories
svn update [filenames] [directories]
Informations about an repository
Some informationen about the reository you'll get with
svn info
Help
svn [option] help
Content list of repository
svn list [filenames] [directories]
List of changes
svn log [filenames] [directories]
Add a file
svn add [filenames] [directories]
Adds a file or a directory with subdirectories to the repository. Note that the new files have to be checked in because this command add the files only to your local working copy.
Move a file
svn move <oldfilename> <new_filename>
Copy a file
svn copy <oldfilename> <new_filename>
Add a directory
svn mkdir <directoryname>
Status of a directory or files
svn status [filenames] [directories]
Differences between working copy and archive
- Show changes of files and directories
svn diff [filenames] [directories]
- Differences between 2 revisions can be shown by
svn diff --revision m:n [filenames] [directories]
- Differences between 2 revisions of a file in meld (or kdiff3) differences viewer
svn diff --revision m:n filename --diff-cmd=meld
Set svn properties/keyword substition for a file
- Set svn keyword substition for a file
svn propset svn:keywords " Author Date HeadURL Id Rev URL" filename
- Set executable properties for a file
svn propset svn:executable filename
- Delete executable properties for a file
svn propdel svn:executable filename