KDevelop 4/Using Git for Development
(Redirected from Using Git for KDevelop4 Development)
KDE uses SVN, so you have to use git-svn. A good place to start. And of course man git-svn ;) Also read git's tutorials and docs: http://git.or.cz/#documentation
Contents |
[edit] Hacking KDevplatform with git
[edit] Getting the source code
First you need to get kdevplatform:
git svn init svn+ssh://YOUR_LOGIN@svn.kde.org/home/kde/trunk/KDE/kdevplatform kdevplatform cd ./kdevplatform/ git svn fetch -r805610
You may find the revision number here (it has to be a revision existing in the directory you want to fetch). Later to sync with SVN just use git svn rebase. Note that if you have uncommitted changes, you better stash them before the rebase run.
git stash git svn fetch
I don't know why, but git svn rebase doesn't work, when you use svn+ssh, but in this case git svn fetch does the same.
git stash apply git stash clear
You may have some build problems, which are discussed below.
[edit] Hacking your own branch
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 KDE techbase carefully:
http://techbase.kde.org/Getting_Started/Set_up_KDE_4_for_development http://techbase.kde.org/Getting_Started/Build/KDE4
Be sure you're in your own branch (not master)
git branch cmakekde
[edit] Committing to the SVN
If you try to commit from your branch (or any other) you will get such message:
git svn dcommit
Use of uninitialized value in concatenation (.) or string at /usr/bin/git-svn line 411. Committing to ... Unable to determine upstream SVN information from HEAD history
I used this article to understand how to commit: http://hassox.blogspot.com/2007/12/using-git-with-svn.html
git-branch -a
You may see something like this:
master my_cool_idea git-svn
To commit we should create local-svn branch, merge our changes to that branch, make an empty commit (with the commit message you want SVN users see) and commit:
git checkout -b local-svn git-svn git merge --squash my_cool_idea git commit -m "Merge with my_cool_ide: cool idea is... Just a cool idea" git svn dcommit
Don't forget to checkout to your my_cool_idea branch.
[edit] Troubleshooting
[edit] SVN:externals
Oops! Missing files (directories):
CMake Error: Cannot find source file "/workspace/gsoc/kdevplatform/plugins/quickopen/expandingtree/expandingdelegate.cpp" for target "kdevquickopen"
The reason is that there are some svn:externals in the repository. See the end of here. 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/KDE/kdelibs/kate/completion/expandingtree%0A
Ok, we found the 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</span>
The revision I took here. Now go to the kdevplatform directory and create symlink:
cd ../../kdevplatform/plugins/quickopen/ ln -s PATH_TO_THE_EXPANDINGTREE
Finally 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 is missing.