Subversion

· by

Contents
This is a quick article I have had as a draft for quite a while. It might not be finished or have other problems, but I still want to share it.

Subversion (Apache Subversion, or svn for short) is a software versioning and revision control system. This allows you to step back to any point of the software and to develop simultaneously on the same project (but not on the same file). You have to make sure that no dependencies are broken, of course.

Here is a little cheat sheet on how to use SVN. I will demonstrate some commands on my Google Code open source project Community Chess.

All commands are executed while I'm in my local working copy of the repository.

Get the repository

svn checkout https://community-chess.googlecode.com/svn/trunk/ community-chess --username [email protected]

Update to the latest version

svn update

Check for changes

If you only want to check which files were modified, added or deleted, you can execute

svn status

This will show your local changes.

File actions

The actions are similar to the console commands, but you have to add svn:

Copy

svn cp myFile.php copiedFile.php

Delete

svn rm myFile.php

Rename / Move

svn mv myFile.php folder/myNewFile.php

Add file

If you created a file and want to submit it with the next commit, just do

svn add myFile.php

Commit the latest changes

Check your changes

First you should try svn status. What files did you change? Do you really want to upload those changes?

If svn status gives you an exclamation mark (!), you might have deleted a file which you wanted to add before. No problem. Just run

svn revert /path/to/your/file.php

I'm fine: Upload it!

This is the command you use if you want to send the changes you made in your working copy to the repository:

svn commit -m "Moved some functions to additional.inc.php to keep the project more flexible; Much work for tournament implementation done; Some Warnings fixed" --username [email protected]

Watch changes

General

See the last three changes:

svn log -v --limit=3
------------------------------------------------------------------------
r118 | [email protected] | 2011-09-26 23:18:42 +0200 (Mo, 26. Sep 2011) | 1 Zeile
Geänderte Pfade:
   M /trunk/clients/Java/ChessClient.class
   M /trunk/clients/Java/ChessClient.java

small changes on the Java Client
------------------------------------------------------------------------
r116 | [email protected] | 2011-09-26 22:53:01 +0200 (Mo, 26. Sep 2011) | 1 Zeile
Geänderte Pfade:
   A /trunk/clients/Java
   A /trunk/clients/Java/ChessClient.class
   A /trunk/clients/Java/ChessClient.java
   A /trunk/install/phpBB3
   A /trunk/install/phpBB3/login.wrapper.php (von /trunk/install/phpbb3.login.php:100)
   A /trunk/install/phpBB3/phpbb3.integration.txt (von /trunk/install/phpbb3.integration.txt:113)
   A /trunk/install/phpBB3/phpbb3.php (von /trunk/install/phpbb3.php:100)
   A /trunk/install/phpBB3/phpbb3.sql (von /trunk/install/phpbb3.sql:103)
   A /trunk/install/phpBB3/wrapper.inc.php (von /trunk/install/phpbb3.wrapper.inc.php:113)
   D /trunk/install/phpbb3.integration.txt
   D /trunk/install/phpbb3.login.php
   D /trunk/install/phpbb3.php
   D /trunk/install/phpbb3.sql
   D /trunk/install/phpbb3.wrapper.inc.php

Made integration instructions for phpBB easier; added Java-Client
------------------------------------------------------------------------
r113 | [email protected] | 2011-09-26 08:29:15 +0200 (Mo, 26. Sep 2011) | 1 Zeile
Geänderte Pfade:
   M /trunk/index.php
   M /trunk/install/chess.sql
   M /trunk/install/phpbb3.integration.txt
   M /trunk/install/phpbb3.wrapper.inc.php
   M /trunk/my_software.php
   M /trunk/wrapper.inc.php

Fixed issue 3 and some more phpBB-Bugs; more detailed integration instructions;Renamed GAMES_THREEFOLD_REPETITION_TABLE
------------------------------------------------------------------------

One specific file

I don't want to get that much output, so I don't apply -v this time:

svn log index.php --limit=3
------------------------------------------------------------------------
r127 | [email protected] | 2011-10-04 00:09:59 +0200 (Di, 04. Okt 2011) | 1 Zeile

Moved some functions to additional.inc.php to keep the project more flexible; Much work for tournament implementation done; Some Warnings fixed
------------------------------------------------------------------------
r113 | [email protected] | 2011-09-26 08:29:15 +0200 (Mo, 26. Sep 2011) | 1 Zeile

Fixed issue 3 and some more phpBB-Bugs; more detailed integration instructions;Renamed GAMES_THREEFOLD_REPETITION_TABLE
------------------------------------------------------------------------
r71 | [email protected] | 2011-08-26 23:13:37 +0200 (Fr, 26. Aug 2011) | 1 Zeile

completed MVC with Vemplator; controlled every php file with phpcs
------------------------------------------------------------------------