** (Optional) If you are building the CDT remote launch plug-in: Install Remote System Explorer End-User Run-time from Juno update site (under General Purpose Tools)

+

** (Optional) If you are building the various lrparser and UPCparser plug-ins: Get the Binary Download from http://grepcode.com/snapshot/repository.grepcode.com/java/eclipse.org/3.5/net.sourceforge.lpg/lpgjavaruntime/1.1.0 and copy it into your Eclipse dropins folder

* Check out 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 building the DSF test plugin, clone the git repo http://git.eclipse.org/c/platform/eclipse.platform.releng.git/ and import the project org.eclipse.test.performance into your workspace

−

** (Optional) If you are using test plugins: anonymous@dev.eclipse.org:/cvsroot/eclipse, checkout the following

+

−

*** org.eclipse.test.performance

+

* Setup Git credentials

* 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

** 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

Line 65:

Line 63:

** From the repo, select Import Projects...

** 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

*** 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

* In Windows->Preferences search for SSH and load you key (private one) in the private key list

* In Windows->Preferences search for SSH and load you key (private one) in the private key list

+

+

Upload keys using web page

+

* http://wiki.eclipse.org/IT_Infrastructure_Doc#Upload_my_public_key

+

+

Manually upload key using shell (you may require to contact admin to get a shell access first)

* Login to git.eclipse.org using your committer login and password

* Login to git.eclipse.org using your committer login and password

mkdir .ssh

mkdir .ssh

Line 137:

Line 169:

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

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

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

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

+

+

== Using Gerrit for CDT ==

+

+

All changes contributed to CDT by non-committers have to go through Gerrit. Committers and non-committers must sign the new Eclipse CLA before contributing code. Please refer to the [http://wiki.eclipse.org/CDT/contributing contributing page] on how to sign your CLA.

+

+

Create a Gerrit account:

+

+

#Go to https://git.eclipse.org/r

+

#If you are a committer, click <u>Sign In</u>. You will be asked to upload you SSH public key.

+

#If you are not a committer, you could use your Bugzilla account or click <u>Register</u> and create an account.

+

+

Setup a Gerrit remote on your local git repo of CDT. Below is the procedure using EGit:

+

+

#Open 'git repositories' view

+

#Expand the repo that corresponds to the CDT repo

+

#Right-click on 'Remotes' and select "Create remote..."

+

#Give it a name like "gerrit_eclipse" and leave "configure push" selected

+

#Click on the 'Change...' button, next to the 'URI' text box

+

#Use one of the following URI, depending on if you are a committer, and/or you have firewall limitation:

*Commit the code you want to review to a branch. That branch does not need to be the master branch, but it should have the latest code (rebased to master). Make sure that the change description starts with a reference to the bug, e.g. "'''Bug 123456. Fixed an NPE in MyClass.java'''".

+

*When doing the commit, make sure the Gerrit ChangeId is added at the end of the commit comment, to allow to link updated commits to this review. This is easy to do with EGit: simply press the "Compute ChangeId for Gerrit code review button" when doing your commit, as shown below (don't worry if the change id is all zeros at first, it will get filled in once the commit is done):

+

<br>

+

[[Image:Changeid.png]]

+

<br>

+

*Also make sure to press the Signed-off-by button right next to the ChangeId button. This is now required by the Eclipse contribution process. Note that you can set a preference to always add "Signed-off-by" when doing a commit with EGit: ''Window->Preferences->Team->Git->Commit Dialog'' and check ''Insert Signed-off-by''.

+

*Right-click on the repo in the Git Repositories view and select "Push..."

+

*Select the Gerrit remote and press Next

+

*The push should be from the branch that has the changes towards refs/for/master. When using HEAD as the source ref, the branch with the change must be checked-out.

+

*Authorization should be done to complete the push. You should use the committer password using ssh for Gerrit, but when using http from eclipse, you must use a special password that can be found after logging in to Gerrit from the web [https://git.eclipse.org/r/#/settings/http-password here]. Details on the [http://wiki.eclipse.org/Gerrit#Git_over_HTTPS main eclipse gerrit page].

+

*Go to https://git.eclipse.org/r/#/q/status:open+project:cdt/org.eclipse.cdt,n,z and you should see the change you just pushed (assuming you are watching the CDT project; if not, you can find it in the All section).

+

+

=== Miscellaneous ===

+

*Automatically insert the changeid for each of your commits

+

**A changeId in a commit does not have negative impacts but is needed for Gerrit reviews so it is worth always putting one.

+

**Go to Preferences->Team->Git->Configuration

+

**Choose the tab "Repository Settings"

+

**Select the repository you want to do this for (in case you have multiple git repositories)

+

**Press the button "Add Entry..."

+

**Key: gerrit.createchangeid

+

**Value: true

+

*Cancelling a review

+

** If you have submitted a patch set for review but want cancel that submission you should 'Abandon' it. The 'Abandon' button is only available to the submitter and is located below each patch set entry within the review as shown below:

+

<br>

+

[[Image:Abandon.png]]

+

<br><br>

+

*Un-marking a file that was automatically marked as reviewed

+

**Select the file

+

**Select the 'Preferences' menu at the top of the page

+

**The right-most option is 'review'. You can uncheck that.

+

<br>

+

[[Image:CDT Gerrit Unreview.png]]

+

<br>

== Posting patches on Bugzilla ==

== Posting patches on Bugzilla ==

−

Until Eclipse provides a Gerrit instance for all projects to use, the mechanism for community contributions remains patches attached to Bugzilla items. So, if you are interested in developing a fix for a particular bug, follow these simple steps:

+

In addition to posting a patch to Gerrit you may also attach it to the bug. Follow these simple steps:

# Clone the CDT repo as per above if you haven't already done so.

# Clone the CDT repo as per above if you haven't already done so.

# Create a branch for your bug.

# Create a branch for your bug.

−

# Develop the fix. Commit changes to your branch as required.

+

# Develop the fix. Commit changes to your branch as required. Note that to create a patch, you can only use a single commit; therefore, if you want to make changes after that first commit, you should select the 'Amend previous commit' button, on the right-top side of the commit dialog.

−

# Once your work is stable and ready to go, create the patch. This is easiest done in the History view.

+

# Once your work is stable and ready to go, create the patch. This is easiest done in the History view. Be aware that a patch can only be created for a single commit.

+

## Be sure to be looking at the History of the entire CDT repository (in the Git Repositories view, select the top element of the repo and choose 'Show in -> History')

## Select the commit from which you want to create the patch. Probably this is the last on your branch. [[Image:CDT_contrib_create_patch_menu.png|thumb|none|Create patch menu]]

## Select the commit from which you want to create the patch. Probably this is the last on your branch. [[Image:CDT_contrib_create_patch_menu.png|thumb|none|Create patch menu]]

## In the dialog, save the patch to a file. [[Image:CDT_contrib_create_patch_file.png|thumb|none|Save to a file]]

## In the dialog, save the patch to a file. [[Image:CDT_contrib_create_patch_file.png|thumb|none|Save to a file]]

−

## Make sure that the option to save in Git format is not selected. This makes it easier for the committers to apply the patch in Eclipse. [[Image:CDT_contrib_create_patch_Eclipse.png|thumb|none|Eclipse-compatible]]

+

## Make sure that the option to save in Git format is selected; this is on the next wizard page. This provides more useful context about the patch, including the commit on which it was based. [[Image:CDT_contrib_create_patch_git.png|thumb|none|Git format]]

−

# Now, you have a patch file that you can attach to a Bugzilla as before in when CDT was hosted in a CVS repo. Be sure to indicate in your Bugzilla comment, to which branch the patch applies so that a prospective reviewer/committer knows which branch to switch to.

+

# Now, you have a patch file that you can attach to a Bugzilla as before in when CDT was hosted in a CVS repo.

Revision as of 13:44, 18 September 2013

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.

Using Gerrit for CDT

All changes contributed to CDT by non-committers have to go through Gerrit. Committers and non-committers must sign the new Eclipse CLA before contributing code. Please refer to the contributing page on how to sign your CLA.

Commit the code you want to review to a branch. That branch does not need to be the master branch, but it should have the latest code (rebased to master). Make sure that the change description starts with a reference to the bug, e.g. "Bug 123456. Fixed an NPE in MyClass.java".

When doing the commit, make sure the Gerrit ChangeId is added at the end of the commit comment, to allow to link updated commits to this review. This is easy to do with EGit: simply press the "Compute ChangeId for Gerrit code review button" when doing your commit, as shown below (don't worry if the change id is all zeros at first, it will get filled in once the commit is done):

Also make sure to press the Signed-off-by button right next to the ChangeId button. This is now required by the Eclipse contribution process. Note that you can set a preference to always add "Signed-off-by" when doing a commit with EGit: Window->Preferences->Team->Git->Commit Dialog and check Insert Signed-off-by.

Right-click on the repo in the Git Repositories view and select "Push..."

Select the Gerrit remote and press Next

The push should be from the branch that has the changes towards refs/for/master. When using HEAD as the source ref, the branch with the change must be checked-out.

Authorization should be done to complete the push. You should use the committer password using ssh for Gerrit, but when using http from eclipse, you must use a special password that can be found after logging in to Gerrit from the web here. Details on the main eclipse gerrit page.

Miscellaneous

A changeId in a commit does not have negative impacts but is needed for Gerrit reviews so it is worth always putting one.

Go to Preferences->Team->Git->Configuration

Choose the tab "Repository Settings"

Select the repository you want to do this for (in case you have multiple git repositories)

Press the button "Add Entry..."

Key: gerrit.createchangeid

Value: true

Cancelling a review

If you have submitted a patch set for review but want cancel that submission you should 'Abandon' it. The 'Abandon' button is only available to the submitter and is located below each patch set entry within the review as shown below:

Un-marking a file that was automatically marked as reviewed

Select the file

Select the 'Preferences' menu at the top of the page

The right-most option is 'review'. You can uncheck that.

Posting patches on Bugzilla

In addition to posting a patch to Gerrit you may also attach it to the bug. Follow these simple steps:

Clone the CDT repo as per above if you haven't already done so.

Create a branch for your bug.

Develop the fix. Commit changes to your branch as required. Note that to create a patch, you can only use a single commit; therefore, if you want to make changes after that first commit, you should select the 'Amend previous commit' button, on the right-top side of the commit dialog.

Once your work is stable and ready to go, create the patch. This is easiest done in the History view. Be aware that a patch can only be created for a single commit.

Be sure to be looking at the History of the entire CDT repository (in the Git Repositories view, select the top element of the repo and choose 'Show in -> History')

Select the commit from which you want to create the patch. Probably this is the last on your branch.

Create patch menu

In the dialog, save the patch to a file.

Save to a file

Make sure that the option to save in Git format is selected; this is on the next wizard page. This provides more useful context about the patch, including the commit on which it was based.

Git format

Now, you have a patch file that you can attach to a Bugzilla as before in when CDT was hosted in a CVS repo.