10 May, 2008

Hacking KDevelop with Git, Part1 (kdevplatform)

This post was published here: http://www.kdevelop.org/mediawiki/index.php/KDevelop_4/Using_Git_for_Development
All updates will be done there!

KDE uses SVN, so you have to use git-svn. A good place to start. And of course man git-svn ;)

First you need to get kdevplatform:
git svn init svn://anonsvn.kde.org/home/kde/trunk/KDE/kdevplatform kdevplatform
cd ./kdevplatform/
git-svn fetch -r805610

You may find the revision number here.
Later to sync with SVN just use
git-svn rebase
You may have some build problems, which are discussed below.

If you want to hack kdevplatform you must work in your own branch:
git checkout -b my_cool_idea
Now you are in your new branch. Hack it without any fear. Note: to sync with svn use only master branch:
git checkout master
git-svn rebase

Then you may merge updates from SVN with your code:
git checkout my_cool_idea
git merge master

Now try to build kdevplatform, but at first read carefully KDE techbase: http://techbase.kde.org/Getting_Started/Set_up_KDE_4_for_development

Be sure you're in your own branch (not master)
git branch

Oops! Missing files (directories):

CMake Error: Cannot find source file "/workspace/gsoc/kdevplatform/plugins/quickopen/expand
ingtree/expandingdelegate.cpp" for target "kdevquickopen"

The reason is that there are some svn:externals in the repository. See the end of my previous post. I'll show how I prefer to solve this problem.
Let's find what externals are missed:
fgrep "svn:externals" ./.git/svn/git-svn/unhandled.log

+dir_prop: plugins/quickopen svn:externals expandingtree%20svn://anonsvn.kde.org/home/kde/trunk/KD

Ok, we have a repository.
cd ..
mkdir kdev_externals
cd ./kdev_externals
git-svn init svn://anonsvn.kde.org/home/kde/trunk/KDE/\
kdelibs/kate/completion/expandingtree expandingtree
cd ./expandingtree
git-svn fetch -r801352

The revision I took here.
Now go to the kdevplatform directory and create symlink:
cd ../../kdevplatform/plugins/quickopen/

Now build kdevplatform and enjoy! And if you have some problems now you know what to do ;)

P.S. Don't forget to update your externals. And use fgrep dir_prop ./.git/svn/git-svn/unhandled.log if something missing.

P.P.S. Some paths look here bad, strange behavior of blogger (if i type in 1 line they're cutted).

P.P.P.S. Feel free to comment :)

No comments: