|Tutorial Series||Getting Started|
|Further Reading||Version Control with Subversion|
|This page is yet to be reviewed for changes required by the migration to Git. Information and commands on this page may no longer be valid and should be used with care. Please see the KDE Git hub page for more details.|
This is a quick KDE-specific introduction for using Subversion to access files and software in KDE's repositories. For comprehensive coverage of Subversion we recommend reading the book "Version Control with Subversion".
In order to use the KDE Subversion repository, you will need a Subversion client program.
If you only need SVN for checking out the sources (read-only), use the protocol: "svn" at the server: "anonsvn.kde.org".
So for example, instead of what you see throughout this tutorial, your paths would be similar to this: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdevelop
Note: Wherever it mentions "yourname@", http, https, or passwords, you should ignore those and use what is mentioned. None of that stuff is needed for the anonymous server.
If you would like to commit changes to the repository, you will need an SVN account, which is obtainable here: get an SVN Account.
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 support, so you will need the --with-ssl --with-zlib options.
Alternatively, you can install one of the many graphical clients out there (for example, kdesvn, albeit unofficial). 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 have had a CVS account before, it has been migrated to the new Subversion client.
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:
You can explore the repository structure at http://websvn.kde.org/
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 its associated programs. Here you will also find the www module, which contains webpages for KDE's site and related ones.
/trunk is further subdivided into these sub-directories:
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/.
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.
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 kdeedu from the KDE repository. You would do:
Subversion users currently using ssh access should use protocol svn+ssh while subversion users currently using password access should use protocol https in the following:
svn checkout --username=<username> <protocol>://svn.kde.org/home/kde/trunk/KDE/kdeedu
For checking out kdevelop from extragear you would do:
svn checkout --username=<username> <protocol>://svn.kde.org/home/kde/trunk/extragear/sdk/kdevelop
Note that you may wish to use the following if the above doesn't work:
svn checkout <protocol>://<username>@svn.kde.org/home/kde/trunk/extragear/sdk/kdevelop
In order to update, you use the update subcommand.
You change into your checked out copy (for those new to this whole process, the checked out copy should be in your Home folder) and issue a svn update (or, shorter, svn up) command.
To know which local files you had modified, you have to do
and look at the files with M (for modified).
Committing to the Subversion repository is accomplished with the commit (ci for short) subcommands:
svn commit # or svn ci # or 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 option with your full message:
svn ci -m "Updating protocol to conform to HTTP/1.1"
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
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 following illustrates the evolution of the keywords:
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:
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 # or svn diff -r PREV:COMMITTED
That is also valid for the svn log command.
It can happen you would like to include a copy of a subdirectory from another place, but just for convenience, not for developing the code in there. Of course it should be updated automatically whenever the original changes. Subversion can help you. You need to edit the property svn:external of the directory the subdirectory should be added to. So for the current directory you use
svn propedit svn:externals .
and then enter lines of the form
Updating will now fetch /trunk/playground/pim/khalkhi into the subdirectoy libkhalkhi.
|Beware that you cannot commit changes you did to the local copy of the external subdirectory, it is just a readonly copy.|
You use svn://anonsvn.kde.org and not another protocol, because anonsvn.kde.org is accessible to everyone. Using https: or svn+ssh: would only work for users of that protocol. There are still some small disadvantage with anonsvn.kde.org: It is not always in synchronization with svn.kde.org, so updates in the original branch may take a while to appear on anonsvn.kde.org. And some strict firewalls are blocking the svn: protocol.
A special case in KDE 3 is the subdirectory admin, containing the KDE 3 build utilities. It is linked in to the top directory in all modules, and maintained in /branches/KDE/3.5/kde-common. For admin the KDE subversion server is configured to allow readonly access for everyone, so if you see
there is no need to change this.
For those of us that like to stay on the "bleeding edge" there's an easy way to keep a local copy of the KDE sources up-to-date — anonymous SVN.
Alternatively, install KDE SVN packages from your distribution.
First, install the subversion (svn) binary if it isn't already on your computer. Your operating system should have a package for it. Alternatively you can download and compile it yourself via the svn project download page. Please read the KDE Subversion tutorial if you are interested in how to use Subversion.
/trunk/ is where the Qt4-based KDE 4 is being developed. The following is the minimal set of modules you will need to check out to build KDE and KDE software:
svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdelibs svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdepimlibs svn co svn://anonsvn.kde.org/home/kde/trunk/KDE/kdebase
You also need to checkout KDESupport:
|If your firewall doesn't allow access to arbitrary ports, substitute svn://anonsvn.kde.org/ with svn://anonsvn4.kde.org:443/ above.|
|The kdebase module has an external dependency, using svn:externals. The problem is, at this time, the externals property is set with an absolute path, pointing to anonsvn. For those using behind a firewall, this is a problem. You can change the property for your workspace, using two commands:
cs KDE svn propset svn:externals "lib svn://websvn.kde.org:443/home/kde/trunk/KDE/kdebase/runtime/kstyles/oxygen/lib" kdebase/workspace/kwin/clients/oxygen svn propset svn:externals "lib svn://websvn.kde.org:443/home/kde/trunk/KDE/kdebase/runtime/kstyles/oxygen/lib" kdebase/workspace/kwin/clients/ozoneThis way the external property will look for the additional files in the websvn repository. There are also kdenetwork/kget/transfer-plugins/bittorrent and kdebase/workspace/kwin/clients/ozone that use svn:externals get the url with svn propget svn:externals PATH and replace anonsvn.kde.org with websvn.kde.org:443 here too.
qt-copy is a copy of the latest stable Qt release which works with KDE, put into SVN for convenience. It also contains patches by KDE developers that haven't found their way to Qt yet. They are recommended for those working with KDE from trunk. Instructions on how to get and configure it can be found here.
|It is recommended to use kde-qt.git instead of qt-copy. git clone git://gitorious.org/+kde-developers/qt/kde-qt.git qt-kde|
If you wish to have a complete copy of KDE TRUNK, you can simply check out the entire source tree with one command:
|It is smarter to first use The KDE Source Repository Web Viewer. Use it to choose which modules to download. This way KDE will be quicker to install and try out.|
If you want additional software packages you can check out the following modules within trunk/ as well:
koffice extragear playground kdereview
So, for example, if you want to check out koffice trunk, you can use:
If you are checking out modules from trunk/ you may be able to save time by using snapshots. Using Subversion trunk snapshots is described at the Subversion snapshots tutorial page.
If you want to track KDE 3 rather than the bleeding edge, you may retrieve the KDE 3.5 sources using:
svn co svn://anonsvn.kde.org/home/kde/branches/arts/1.5/arts svn co svn://anonsvn.kde.org/home/kde/branches/KDE/3.5/
And if you want the matching qt-copy:
KDE modules are also tagged at each release so that it is possible to get a specific release of KDE. Most KDE modules have a tag name in the format tags/KDE/X.Y.Z (where X, Y and Z represent the exact version). The arts module (only needed for KDE 2 and KDE 3) has a different format of tag name, tags/arts/X.Y.Z. For instance to get kdelibs as it was shipped in KDE 3.5.0, do:
If you then want to update this checkout to KDE 3.5.5, use this command:
|If you used a /branch/ or /trunk/ path, then there is no need to switch, just run svn update.|
|The l10n module is extremely large. Be sure you have lots of time and disk space on hand before checking out the entire l10n module. Most people only check out specific language subdirectories rather than the entire l10n module.|
If the tip above didn't help you, and you've realized that the only way to go seems to be with http://anonsvn.kde.org/.. , then you will have to jump through a few hoops to get an svn checkout. Since http:// access is open only to developers, you will have to use svn://. Transconnect is a small piece of software that can tunnel all the traffic through your friendly neigbourhood proxy server. Get the transconnect sources from http://transconnect.sourceforge.net/ , compile it, and edit ~/.tconn/tconn.conf to point to your proxy server. Export the LD_PRELOAD variable as per the README from transconnect, and you're set to go.
svn switch --relocate svn://anonsvn.kde.org/ svn://kde.mneisen.org/
If you're interested in setting up a svn mirror, please contact the KDE sysadmins.