Subversion

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search

This page introduce the use of subversion. If you're only intent is to get the files from subversion you should start with Obtaining the library source from Subversion which help you in getting the file and compiling CEGUI. This page dive deeper in the use of subversion as a standard user as well as a developer of the library itself. This page presents the use of subversion with the command line tool available for windows, mac and linux.

First of all here is some urls to get started with subersion usage :


Glossary

  • Repository: That's the place storing all the files and revisions. It's hosted by sourceforge. In Subversion respository are identified using urls.
  • Working Copy: A working copy is a local view of part of the repository. You can retrieve a local copy using the checkout command. A working copy contains the file as well as a lot of additional information. The size of the working copy is more than twice the size of the file of the project.
  • Branches: Subversion does not provides branches concept, however it's possible to organize the project in several branches. The current development branch is known as trunk. The other branches are stored in a folder named .... branches. So a branch in Subversion is just a folder in branches.
  • Tags: Subversion does not provides tags concept. Like branches tags are only subfolder of the tags folder.
  • Revision: Snapshot of the tree at a given time. Each modification on the tree create a new revision.

Layout of the repository

At this moment there are two projects in the CEGUI repository. The CEGUI library and the layout editor. The repository is organised as follows:

  • cegui_mk2 : The cegui library itself
    • trunk : The main development stream
    • branches : Branches (features testing are prefix with pre-)
    • tags: Release of the CEGUI library
  • CELayoutEditor : The editor files
    • trunk : The main development stream
    • branches : Branches
    • tags: Release of the editor

Getting a working copy of the project

In order to get the files from the Sourceforge server one can use two commands. Both commands retrieve the files, however the second command excludes you from staying up-to-date or create patches. If you plan to get the sources, create your library, install it and remove them, the second solution is the best for you.

svn checkout url [dest_dir] 
svn co url [dest_dir]

or

svn export url [dest_dir]

Using each of these commands you will get you the latest version of any file with url as root tree. You can get files at a particular revision using an additional parameter:

svn checkout/export [-r number] url [dest_dir]. It useful to test older version. There is no named revision in subversion but it's easy to create tags which provides the same features.

Updating your working copy

When you choose 'checkout', you now have a working copy of the library or the editor. You can keep it in sync with the repository at Sourceforge with the following command:

svn update [folder|file]
svn up [folder|file]

Getting history of modifications

In order to get a kind of changelog you can use subversion. Each modification of the repository comes with a text message explaining the last modification. You can get the history of any file or directory of your working copy using:

svn log [url]  (remote repository) 
svn log [path] (working copy)

Making change to your working copy

There is several change that can be made on subversion repository : adding, removing, renamming and modifying files, adding, removing and renamming directory. A standard work session consists in the following operation.

  1. Update your working copy
  2. Make your change
  3. commit your change

This section focus on the second step of a work session. Files and directory are not handled automatically by subversion you must first explain to subversion that those file must be manage d. This is done using the add command:

svn add source.cpp // Add source.cpp to your local subversion copy 
svn add subdir  // Add subdir to your local subversion copy as well as all file contained in the repository itself 

One of the improvement of subversion compared to CVS is its ability to remove file as well as folder this done by the rm or delete command

svn del source.cpp 

Finally you can rename file or directory using the mv command. This command does not allow mass moving like the standard mv command of unix system. rename is an alias of this command.

svn mv source dest 

You can use any text editor to edit your files. Subversion will do its best to send on the network only the change you've made to your working copy.

Must talk about loking facilities here

Branching, Tagging, Merging

In subversion a branch or a tag is just a folder in the corresponding folders. In order to create a branch one needs to use the copy operation. Copying a complete tree in subversion is cheap. In order to create a branch or tag use the following operation :

svn copy url_source url_dest 

I suggest using url of the repository directly. In order to create a branch of CEGUI use :

svn copy https://svn.sourceforge.net/svnroot/crayzedsgui/cegui_mk2/trunk https://svn.sourceforge.net/svnroot/crayzedsgui/cegui_mk2/branches/v0-5

To create a tag use :

svn copy https://svn.sourceforge.net/svnroot/crayzedsgui/cegui_mk2/branches/v0-5 https://svn.sourceforge.net/svnroot/crayzedsgui/cegui_mk2/tags/v0-5-0 

A final notes on TAG. Nothing prevents someone to make changes on a tag. It's up to the developer to do changes only on trunk and branches.


If you have fixed a lot of bug in a subsystem or want to apply some of the change made to trunk to a specific branch you have to merge. Merging requires a working copy.

svn merge url_from url_to working_copy_path

Merging need some improvement Need to add some information on conflict

Properties

Subversion allows one to attach meta information to any file and folder in the repository. Those information are called properties. The table bellow list most interesting properties:

Name Values Description Files Directories
svn:executable set/unset Tel whether the file should be made executable or not yes no
svn:mime-type mime of the file Tel the mime type of the file. This is use to select the diff algorithm used yes no
svn:ignore *.o *.lo ... List file to be ignore by svn command no yes
svn:keywords Date,Revision,Author,HeadURL,Id It allows subversion to automatically substitue some field in the file on check out or update yes no
svn:eol-style native*,CRLF,CR,LF It allows automatic conversion from one eol style to another yes no
svn:externals svn url It allows to create soft link between to subversion repository no yes
svn:needs-lock set/unset Tel whether the file must be locked before editing or not yes yes

You can also defines your own properties for whatever use you might need them. When one adds a file to subversion it must add the svn:eol-style property to the value native for all text file. It can be made automatically using autoprops facilities of svn.


In order to manipulate properties you can use

svn propset name value url/file 
svn proplist url/file
svn propget name url/file 
svn propdel url/file
svn propedit name url/file

Pitfalls

Configuring subversion

External Links