Difference between revisions of "Getting Started/Sources/Subversion"

Jump to: navigation, search
(initial port of: http://developer.kde.org/documentation/tutorials/subversion/)
(The top-level directory /trunk: Fix dir listing of koffice)
Line 105: Line 105:

Revision as of 12:00, 17 December 2006

This is a quick KDE-specific introduction, for all Subversion details read the "Version Control with Subversion" book.


Getting started

In order to use the KDE Subversion repository, you will need two things:

  1. A Subversion client program
  2. An account in our repository

Note: For anonymous read-only access use protocol "svn", no "yourname@" and server "anonsvn.kde.org" instead below.

Installing Subversion: instructions on installing the client are not presented here. Refer to your system installation instructions to find out how you can install Subversion. You will need version 1.1 at least. If you are compiling from sources and want to access the KDE repository by https (and not by svn+ssh), you will need SSL and ZLIB supports, so you will need the --with-ssl --with-zlib options.

Alternatively, you can install one of the many graphical clients out there. This tutorial is intended for people using the svn program only, referring to tasks accomplished with the usual cvs program.

Getting an account: if you had a CVS account before, it has been migrated to the new Subversion client. If you didn't, refer to the corresponding tutorial how to get one.

Note: if you have lost your CVS password, there are simple ways to retrieve it. Use cvspwd.c or cvs-unscramble (Perl).

[#top Top]

The KDE repository structure


That's the address of the KDE Subversion repository. The repository is served by HTTPS or SVN+SSH protocol, which means your password is secure against third-party eavesdropping.

The SSL certificate md5 fingerprint for the repositories:

F6BF EDE2 D016 D1B2   4F18 742E 2C8F B7EF

The SSL certificate sha1 fingerprint for the repositories:


For people using svn+ssh, here's the fingerprint of the server's RSA key:


The repository is organised in main directories:

  1. /branches
  2. /tags
  3. /trunk

You can explore the repository structure at http://websvn.kde.org/

The top-level directory /trunk

The /trunk top-level subdirectory is where the main development for KDE occurs. What you will find here is what will become the next KDE release, and of its associated programs. You will also find here the www module, which contains webpages for KDE's site and related ones.

/trunk is further subdivided into these sub-directories:

  • KDE/
KDE itself, what will become the next public release. It contains the following modules:
    • arts - Soundserver (removed in KDE 4)
    • kde-common - Common admin/ directory
    • kde-i18n - Translations
    • kdelibs - KDE basic libraries, used by all KDE programs
    • kdebase - KDE base programs, like the KDE Control Center, Kicker (the panel) and Konqueror (the web browser)
    • kdeaccessibility - Accessibility files
    • kdeaddons - Add-ons and plug-ins to KDE programs
    • kdeadmin - KDE Administration applications
    • kdeartwork - Images, themes, sounds and other art files
    • kdebindings - Bindings for languages other than C++
    • kdeedu - KDE Educational applications
    • kdegames - KDE Games
    • kdegraphics - KDE Graphical applications
    • kdemultimedia - KDE Multimedia applications
    • kdenetwork - KDE Networking applications
    • kdepim - KDE Personal Information Management applications
    • kdesdk - KDE Software Development Kit applications
    • kdetoys - KDE toy applications
    • kdevelop - The KDevelop program
    • kdeutils - KDE General utilities
    • kdewebdev - KDE Web development applications
  • bugs/
Bugzilla files
  • developer.kde.org/
The content of developer.kde.org
  • extragear/
KDE programs outside the main KDE releases.
  • kdereview/
Temporary home for KDE applications that are believed to have reached release-quality. From here, once all major issues are resolved, applications are moved either to /trunk/KDE/ or to /trunk/extragear/
  • kdesupport/
Supporting applications and libraries for KDE
  • koffice/
The KDE Office suite, containing the programs:
    • karbon
    • kchart
    • kexi
    • kformula
    • kivio
    • koshell
    • kplato
    • kpresenter
    • krita
    • kspread
    • kugar
    • kword
  • konstruct/
Konstruct, the KDE build program
  • playground/
The KDE playground: applications being developed, but not having yet reached release-quality.
  • qt-copy/
The convenience copy of Trolltech's Qt library, which KDE is based upon.
  • tests/
khtml, KOffice and ksvg testcases
  • valgrind/</dt>
The Valgrind application, which is hosted on the KDE repository, but that is not part of KDE itself.
  • www/
Webpages for the KDE site (and related sites). Write access to this directory is restricted.

The top-level directory /tags

This directory contains the official releases of the programs maintained and developed in the KDE repository. Each individual application has a subdirectory here. Inside it, you will find the release numbers.

For instance, the KDE 3.4.0 code can be found under /tags/KDE/3.4.0/.

The top-level directory /branches

This directory contains the branch versions of the applications after a major release.

Most KDE applications adhere to the philosphy that new features (as well as new user-visible strings) are added only to the next release cycle — the one that lives in /trunk/. However, bugfixes are applied to all applications, even after release.

In order to do that, a branch is created at the moment of the release, indicating the state of the files at that time. Bugfixes are then checked in to those files. Those branches are the ones in /branches/.

For instance, the KDE 3.4.x branch can be found under /branches/KDE/3.4/

The subdirectories you will find inside /branches are the application subdirs, like akregator/, amarok/, arts/, k3b/, etc. You will also find a KDE/ subdir, containing the official KDE releases since time immemorial.

One special subdir is found in /branches: work/. This subdir contains the so-called "work branches", that is, branches containing features being worked on, sometimes highly experimental. Multi-application work branches always are checked in to /branches/work/, but single-application branches may be found in each application's subdir. That is a decision left to the developers.

Logging in to the KDE repository

The cvs login operation you used to perform is no longer necessary. This operation is now performed during the checkout itself, since you access the Subversion Repository using its URL.

Checking out and updating

Checking out

In order to check out something with Subversion, you use the checkout subcommand.

WARNING: If you checkout trunk/KDE/ or branches/KDE/foo/ you will download complete kde-i18n!

Suppose you wanted to check out only KDevelop from the KDE repository. You would do:

CVS command:

cvs -d :pserver:yourname@cvs.kde.org:/home/kde login
cvs -d :pserver:yourname@cvs.kde.org:/home/kde checkout kdevelop

Subversion command:

CVS users currently using ssh access, should use protocol svn+ssh, CVS users currently using password access, should use protocol https in the following.

svn checkout <protocol>://<username>@svn.kde.org/home/kde/trunk/KDE/kdevelop


In order to update, you use the update subcommand.

This is no different from CVS: you change into your checked out copy and issue a svn update (or, shorter, svn up) command.

Knowing the status of a file

To know which local files you had modified, in CVS most people did

cvs up

and looked at the files with M, this does not work with svn so you have to do

svn status

to know the status of the files.

Committing to the repository

Just like in CVS, committing to the Subversion repository is accomplished with the commit or checkin (ci for short) subcommands.

CVS command:

cvs commit


cvs ci


cvs ci filename.cpp

Subversion command:

svn commit


svn ci


svn ci filename.cpp

This way, svn will launch the editor specified in $SVN_EDITOR for you to compose the commit message. If you prefer, you can give svn the -m oprtion with your full message:

svn ci -m "Updating protocol to conform to HTTP/1.1"

Ignoring files

Subversion stores ignored files per directory. To edit the ignored files of the directory you are currently in, do

 svn propedit svn:ignore .

that will launch your editor, write there the names of the files you want to ignore, one file per line. Once you are done, do a commit so the ignored list file gets updated on the server.

A lot of files were ignored in CVS with help from global ignore list which is not supported yet by SVN. You can wait for svn 1.3 or you need to add the ignore list to the [miscellany] group in your ~/.subversion/config (all in one line):

global-ignores = *.o *.lo *.la .*.rej *.rej .*~ *~ .#* #*# .DS_Store *.moc
*.moc.cc *.moc.cpp config.log config.status config.cache *.gmo .deps .libs
SunWS_cache *.lo *.la *.rpo *.la.closure *_la_closure.cpp *_la_closure.cc
*_la_closure.cxx *.all_cc.cc *.all_cpp.cpp *.all_C.C *.all_cxx.cxx
*_meta_unload.cc *_meta_unload.h *_meta_unload.cpp *_meta_unload.C
*_meta_unload.cxx index.cache.bz2 .memdump Makefile.rules.in Makefile.calls.in
Makefile.rules Makefile.calls autom4te.cache *.kidl

Working with multiple revisions and branches

Unlike CVS, Subversion doesn't generate a revision number for each file modified. Instead, the full repository is versioned, as a whole. This way, a given revision number represents the state the repository was on a given date. In other words, a revision number is like a timestamp (in fact, the Subversion server uses this fact to search for dates in the repository faster).

So, for instance, when you check out the KDE repository, Subversion will tell you the following:

Updated to revision 403821.

This means that the latest revision available at the time of the operation was 403821. If you make a modification and commit, Subversion will update the server-side revision and will inform you of it. Like CVS, only the committed files will be updated: you will need run cvs up to update the rest of the files.

If you want to retrieve a specific revision of a file, you can use the -r switch. Besides the revision number itself, -r accepts a number of other possibilities:

  • The revision number: for example, use -r 403819 to retrieve that version
  • BASE: the revision you updated to
  • COMMITTED: the revision a file was last modified, before BASE
  • PREV: the revision of the previous commit to the file before COMMITTED
  • HEAD: the most recent revision available in the server
  • { date }: between curly brackets, you can specify a date for searching the closest revisions

The following illustrates the evolution of the keywords:

  1. You run svn up to update to the latest available revision. Suppose Subversion tells you it updated to revision 403821. This means that HEAD and BASE are 403821.
  2. You modify file README and commit it. Suppose Subversion tells you it committed revision 403822. This means HEAD, BASE and COMMITTED are 403822.
  3. You modify the file again and commit it. Now PREV is 403822, but HEAD, BASE and COMMITTED are updated to a new value (suppose it's 403823).
  4. Now someone else modifies the repository, and you update your working copy. If Subversion tells you it updated to 403824, this means now HEAD and BASE are moved to 403824 (but PREV and COMMITTED stay the same)
  5. If someone modifies the README file now, HEAD is moved. The other keywords stay the same for you, until you update. At this time, we will have HEAD = 403825 (the latest available revision), BASE = 403824 (the revision you last updated to), COMMITTED = 403823 (the revision of the latest change to the file when you last updated) and PREV = 403822 (the revision of the change before COMMITTED)

Those keywords are useful to retrieve logs and diffs for commits to the repository.

If you want to see the difference between your working copy and BASE, you can run:

svn diff

This is a very fast operation, since Subversion keeps a local copy of BASE. It doesn't need a network connection to accomplish this operation.

If you want to see the difference between your local copy and the latest available on the server, you will run:

svn diff -r HEAD

If you want to see what has changed in the repository since you've last updated, you can use:

svn diff -r BASE:HEAD

If you want to see the last change to a file before BASE, you can use:

svn diff -r PREV:BASE


svn diff -r PREV:COMMITTED

That is also valid for the svn log command.

More information on the kde wiki

See the KDE wiki for more information about subversion in KDE

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal