Difference between revisions of "Using Subversion"

From AIRWiki
Jump to: navigation, search
(creation)
 
Line 1: Line 1:
For general information about Subversion and how to use it, please see the [http://svnbook.red-bean.com/ Subversion manual].  If you are not familiar with version control systems, the first chapter of the manual is a must-read.  If you are familiar with [http://en.wikipedia.org/wiki/Concurrent_Versions_System CVS], please read at least [http://svnbook.red-bean.com/nightly/en/svn.forcvs.html Appendix B] of the manual.  From the command line, ''svn help'' gives you a complete overview of the commands and their use.
+
For general information about Subversion and how to use it, please see the [http://svnbook.red-bean.com/ Subversion manual].  If you are not familiar with version-control systems, the first chapter of the manual is a must-read.  If you are familiar with [http://en.wikipedia.org/wiki/Concurrent_Versions_System CVS], please read at least [http://svnbook.red-bean.com/nightly/en/svn.forcvs.html Appendix B] of the manual.  From the command line, ''svn help'' gives you a complete overview of the commands and their use.
  
 
On the [http://www.bci2000.org/wiki/index.php BCI2000 Wiki], you can find good tutorials on [http://www.bci2000.org/wiki/index.php/Programming_Howto:SVN_Client_Setup using the Subversion client] and  
 
On the [http://www.bci2000.org/wiki/index.php BCI2000 Wiki], you can find good tutorials on [http://www.bci2000.org/wiki/index.php/Programming_Howto:SVN_Client_Setup using the Subversion client] and  
[http://www.bci2000.org/wiki/index.php/Programming_Howto:Using_TortoiseSVN TortoiseSVN].  They have been written for BCI2000, but can be used also for other repositories if you change the URLs.
+
[http://www.bci2000.org/wiki/index.php/Programming_Howto:Using_TortoiseSVN TortoiseSVN].  They have been written for BCI2000, but can be used also for other repositories if you change the URLs.  Another graphical front-end for Subversion is [http://rapidsvn.tigris.org/ RapidSVN], which is cross-platform and works with Linux.
  
 
See also the [[Configuring Subversion]] page.
 
See also the [[Configuring Subversion]] page.
 +
 +
==Quick Introduction==
 +
Please really do read the [http://svnbook.red-bean.com/ Subversion manual], and in particular the first chapter if you are new to version-control systems or the Appendix B if you are used to CVS.  Here follows a short list of the tasks that you can accomplish using Subversion, so you have an idea of what you can (or should) do.
 +
;Creating new files from scratch
 +
:Create the file as usual (e.g., File->New from your favorite editor) and add it to the repository when you have the first version ready. You can use the <tt>svn add</tt> command from the command line or the equivalent command from a graphical front-end.
 +
;Creating new files from existing files
 +
:Use the <tt>svn copy</tt> command (or the equivalent menu entry of a graphical front-end) to create a copy of the file and edit the new file. This is needed to preserve the modification history; do not make the copy with a file manager or operating system commands.
 +
;Renaming or moving files/directories
 +
:The <tt>svn move</tt> command is the correct way to rename a file/directory or to move it from a directory to another one. Do not use a file manager or other operating system commands, as this will lose the history of the file.
 +
;Creating new directories
 +
:Use the <tt>svn mkdir</tt> command. Alternatively, you can create a directory with you favorite file manager and then use the <tt>svn add</tt> command (in this case any file in the directory may be added to the repository).
 +
;Commit changes
 +
:This is '''important'''. Every change you make is local until you perform a commit; from the command line, use <tt>svn ci</tt>. This transfers the local changes to the repository on the server (it works in one direction only: It doesn't fetch modifications from the server).
 +
;Update from the server
 +
:In order to receive the modifications made by others on the repository you have to issue an <tt>svn update</tt> command.  This modifies only your local copy, and doesn't modify in any way what's on the server.
 +
:It's a good practice to make an update every time you begin to work on a file, so you get notified of any change that someone else has made.
 +
;View history and changes
 +
:You can examine the history of a file or directory with the <tt>svn log</tt> command.  It shows who made any modification to the repository and when, and also which files were affected.
 +
:You can examine the differences between your local version of a file or directory and any older version, or between two old versions.  Please refer to the help on the <tt>svn diff</tt> command for the details.
 +
;Retrieving or restoring old versions
 +
:You can access an old version of a file with <tt>svn cat</tt> command.

Revision as of 12:42, 27 March 2009

For general information about Subversion and how to use it, please see the Subversion manual. If you are not familiar with version-control systems, the first chapter of the manual is a must-read. If you are familiar with CVS, please read at least Appendix B of the manual. From the command line, svn help gives you a complete overview of the commands and their use.

On the BCI2000 Wiki, you can find good tutorials on using the Subversion client and TortoiseSVN. They have been written for BCI2000, but can be used also for other repositories if you change the URLs. Another graphical front-end for Subversion is RapidSVN, which is cross-platform and works with Linux.

See also the Configuring Subversion page.

Quick Introduction

Please really do read the Subversion manual, and in particular the first chapter if you are new to version-control systems or the Appendix B if you are used to CVS. Here follows a short list of the tasks that you can accomplish using Subversion, so you have an idea of what you can (or should) do.

Creating new files from scratch
Create the file as usual (e.g., File->New from your favorite editor) and add it to the repository when you have the first version ready. You can use the svn add command from the command line or the equivalent command from a graphical front-end.
Creating new files from existing files
Use the svn copy command (or the equivalent menu entry of a graphical front-end) to create a copy of the file and edit the new file. This is needed to preserve the modification history; do not make the copy with a file manager or operating system commands.
Renaming or moving files/directories
The svn move command is the correct way to rename a file/directory or to move it from a directory to another one. Do not use a file manager or other operating system commands, as this will lose the history of the file.
Creating new directories
Use the svn mkdir command. Alternatively, you can create a directory with you favorite file manager and then use the svn add command (in this case any file in the directory may be added to the repository).
Commit changes
This is important. Every change you make is local until you perform a commit; from the command line, use svn ci. This transfers the local changes to the repository on the server (it works in one direction only: It doesn't fetch modifications from the server).
Update from the server
In order to receive the modifications made by others on the repository you have to issue an svn update command. This modifies only your local copy, and doesn't modify in any way what's on the server.
It's a good practice to make an update every time you begin to work on a file, so you get notified of any change that someone else has made.
View history and changes
You can examine the history of a file or directory with the svn log command. It shows who made any modification to the repository and when, and also which files were affected.
You can examine the differences between your local version of a file or directory and any older version, or between two old versions. Please refer to the help on the svn diff command for the details.
Retrieving or restoring old versions
You can access an old version of a file with svn cat command.