Difference between revisions of "CDT/git"

From Eclipsepedia

Jump to: navigation, search
m (Rearranged text for clarity)
Line 29: Line 29:
*[http://www.youtube.com/watch?v=1OrPJClD92s&feature=related Using Git GUI with Eclipse Part II - Pushing changes to the server] [http://www.youtube.com/watch?v=WU9xYP_NScQ]<br>  
*[http://www.youtube.com/watch?v=1OrPJClD92s&feature=related Using Git GUI with Eclipse Part II - Pushing changes to the server] [http://www.youtube.com/watch?v=WU9xYP_NScQ]<br>  
*[http://www.youtube.com/watch?v=WU9xYP_NScQ Setting up SSH authorized keys in Eclipse] [http://www.youtube.com/watch?v=Lhwi3z2DyzQ&feature=related]  
*[http://www.youtube.com/watch?v=WU9xYP_NScQ Setting up SSH authorized keys in Eclipse] [http://www.youtube.com/watch?v=Lhwi3z2DyzQ&feature=related]  
*[http://www.youtube.com/watch?v=Lhwi3z2DyzQ&feature=related Creating and Applying Patches to CDT git repo] [http://www.youtube.com/watch?v=I5uq6dWdi0w&feature=related]
*[http://www.youtube.com/watch?v=I5uq6dWdi0w&feature=related CDT Pushing Changes to Master]
*[http://www.youtube.com/watch?v=I5uq6dWdi0w&feature=related CDT Pushing Changes to Master]
== Setting up your workspace with the CDT Repo ==
== Setting up your workspace with the CDT Repo ==

Revision as of 22:10, 16 August 2011

To make it easier for adoptors and contributors to work with the CDT source, we moved to GIT source control system June 24th 2011. Old CVS repo is read only now.

This document will ultimately be the guide for using git and egit with CDT.


Source Repositories

CDT is now broken into two git repos. You can view repos at http://git.eclipse.org/c/. Core cdt org.eclipse.cdt.git, EDC repo is org.eclipse.cdt.edc.git. If you want to practice there are also test repos, test3/*...

Committers will want to access the master repository via ssh


where "userid" is your Commiter login name (what you used with CVS and what you use with My Foundation Portal).

Everyone else will use either of the following URLs


Click here for further information on the Git repos available to CDT developers


Doug Schaefer has posted numerous screencasts on using git with Eclipse

Setting up your workspace with the CDT Repo

Follow these instructions to get working with the CDT repo out on eclipse.org.

Main CDT

  • Eclipse Setup (tested with Indigo)
    • Eclipse Classic 3.7
    • Install Cdt on top on eclipse or install a separate copy of CDT 8.0 to establish an API baseline. See CDT/policy#Using_API_Tooling
    • In Preferences set API baseline (you can set it to its own installation if it has CDT in it)
    • Install Egit 1.0 (you can get it from Indigo update site). See docs http://wiki.eclipse.org/EGit/User_Guide
    • (Optional) If you are using CDT remote launch: Install Remote System Explorer Run-time for build dependencies
  • Check out build dependencies
    • (Optional) If you are using lp-parsers: from anonymous@dev.eclipse.org:/cvsroot/tools, org.eclipse.orbit, checkout the 1.1 version of net.sourceforge.lpg.lpgjavaruntime
    • (Optional) If you are using test plugins: anonymous@dev.eclipse.org:/cvsroot/eclipse, checkout the following
      • org.eclipse.test.performance
  • Setup Git credentials
    • eGit wiki says that it would pop-up dialog for e-mail and name of committer. I did not see it. You have to set it up manually if you did not see the dialog
    • Windows->Preferences search Git, select Configuration->User Settings
    • Click New Entry... add key[user.name] value[your name]
    • Click New Entry... add key[user.email] value[your committer e-mail]
    • Click ok
  • Clone the repo. See either Doug's video http://www.youtube.com/watch?v=O4rDgx6-B6Q here or instructions below:
    • From the Git perspective, select clone repo action
      • Cut & Paste url below in the first page of wizard for cloning
      • Enter your committer credentials or anonymous (for permanent credentials use ssh keys see below).
      • It will ask you what branches to import. If you only care about head select master, if you want to work with other branches select a corresponding branch, for example cdt_8_0.
      • Press Next. As location where files are stored select a folder inside your workspaces, for example workspace/cdt-git
      • Press Finish (skip Gerrit page)
      • This should take about 3-5 minutes
    • From the repo, select Import Projects...
      • Select all the projects or individual. Project filter does not seems to work. It maybe easier select all, then close projects you don't need
    • Let the build run. To build properly you should have set API baseline, see comment above about API baseline.
  • Another video http://www.youtube.com/user/cdtdoug#p/a/u/1/I5uq6dWdi0w

And that's it. One way to test you have everything is to try and Export the master feature. That'll give you everything our official builds do.

Please also read CDT/policy if you are new committer or want to contribute to CDT. Also check CDT/contributing wiki on how to contribute a patch.

There is also wiki for eclipse/git marriage here - http://wiki.eclipse.org/Git


More for EDC soon.

Setting up SSH keys for committees

Doug has video about setting up ssh keys http://www.youtube.com/watch?v=WU9xYP_NScQ&feature=related.

  • To make it work first send request to webmaster@eclipse.org and ask for unrestricted shell, they will give you shell for 24 hours.
  • Generate ssh keys using puttygen or ssh-keygen tools (mingw for windows, native for mac and linux)
  • In Windows->Preferences search for SSH and load you key (private one) in the private key list
  • Login to git.eclipse.org using your committer login and password
mkdir .ssh
chmod 700 .ssh
cd .ssh
cat >> authorized_keys #or open in vi
<paste your public key here>
chmod 600 authorized_keys
  • You can use more than one key if you want to login from diffrent hosts (or you can save key on diffrent hosts - up to you)
  • If you do all this stuff eGit won't ask 10 times for your password anymore!

Committing to remote repository

  • Checkout the branch you want to commit changes, for example local:master -> remote:master
  • If it is already checked out, try Fetch to make sure it is in sync
  • Apply patch
  • Commit. Specify Author - contributor of the patch, and yourself as Committer
  • Push.
    • If push failed, you may not be having latest version. In this case Rebase to respective remote branch. It will undo your patch, then fetch, then apply your patch.
  • Fetch. This will synchronize your local branch with latest "push" which is kind of stupid because it was your own push that you just did.

In history view you should see

[master][origin/master][HEAD] Bug xxx - your fix

Committing to two branches

Let say we have a patch and we want to commit fix to cdt_8_0 branch and master

  • Make sure you have both branches in your Local branches list
    • If not create another missing one (from respective remote one)
  • Checkout cdt_8_0
  • Fetch
  • Apply patch
  • Commit patch
  • Checkout master
  • Open History view
  • Make sure button "Show all branches" checked
  • Find your commit
  • Right click on it and Select Cherry Pick, that should apply it to master branch
  • Push (make sure both branches are selected in the dialog to push). Both changes would be pushed now.
  • Fetch
  • Checkout cdt_8_0

At the end of this beauty your history view should show

[master][origin/master] Bug xxx - your fix
[cdt_8_0][origin/cdt_8_0][HEAD] Bug xxx - your fix