Skip to main content
Jump to: navigation, search

Difference between revisions of "Scout/Contributions for Scout Committers"

(Bugzilla: => change to " account")
(Git settings)
Line 76: Line 76:
* '''File Formatting:''' Add <tt>core.autocrlf=input</tt>
* '''File Formatting:''' Add <tt>core.autocrlf=input</tt>
* '''Default pull strategy:''' Add <tt>branch.autosetuprebase=always</tt>
* '''Default pull strategy:''' Add <tt>branch.autosetuprebase=always</tt>
* '''Auto prune on fetch:''' Add <tt>fetch.prune=true</tt>
Contributed text files are stored in the repository in the following way:  
Contributed text files are stored in the repository in the following way:  
Line 91: Line 92:
         autocrlf = input
         autocrlf = input
        prune = true
         autosetuprebase = always
         autosetuprebase = always

Revision as of 08:11, 28 July 2014


In order to work efficiently as a scout committer you need to setup your tools correctly. Here, we try to describe a setup that is simple and working. You only need to do this once.

We try to use a minimal set of tools, i.e. eclipse with egit and mylyn and a webbrowser. Many people also use gitextensions or the command line, because more features are available. But it is possible contribute without these tools.

Please also read the contribution guidelines before you start. account

Make sure you have a account. This will provide access to Eclipse Bugzilla and Eclipse Gerrit.

Contribution tracking is made with Bugzilla. You need to know how handle Bugzillas for Scout (read Opening new Bugs and Bug Life Cycle)

Contributor License Agreements

In order to contribute to Eclipse Scout, you need to sign the Contributor License Agreements (or CLA).

This is straight forward: connect to and click on Contributor License Agreements. Read the document and answer the questions.

CLA 01 home.png

CLA 02 questions.PNG

CLA 03 form.png

Eclipse Installation

You need an eclipse IDE with egit and preferrably mylyn. For development for the luna release you can use the latest Eclipse for Scout Developers package that includes both plugins.


Scout Bundles are still compatible to Java 1.6. Therefore you should configure at least JRE 1.6 in eclipse and preferably also JRE 1.7.

Endorsed Java Mail: Due to problems with JAX-WS and JavaMail and JMS (see [1] and [2]) an endorsed directory needs to be provided for the JRE. Download JavaMail and jms from Oracle [3] and put it into the endorsed directory of the JRE. Your directory structure should look like that:


The two jar files should appear in the list of system libraries in the Eclipse JRE Definition (open Preferences->Java->Installed JREs, Edit...). If not either restart eclipse or add them manually.

tools.jar: For compiling the JAX-WS plugins you need to add the tools.jar:

In Eclipse open Preferences->Java->Installed JREs->Add->Standard VM and select your JRE.

  • Click on "Edit..."
  • Click on "Add External JARs..."
  • Select <jdk>\lib\tools.jar

Scout Add JRE.png

In Java->Installed JREs->Execution Environments select the correct JRE for JavaSE-1.6 and JavaSE-1.7.


An SSH Key is needed for authentication without username/password for pushing changes into the repository. For read-only access it is not necessary.

Here is how you create a new SSH Key in eclipse.

  • Open Window / Preferences in eclipse
  • Go to General / Network Connections / SSH2
  • Open tab Key Management
  • Generate DSA Key…
  • Comment: email
  • Enter Passphrase / Confirm Passphrase
  • Save in C:\Users\username\.ssh. This is your private key. Make sure to always store it in a save place.

GitContribution createSSHKey.png

In order to be able to push to git and gerrit, you need to upload your SSH key.

Gerrit is located here: Sign in with your email and password and add the key.


Git settings

Before cloning update your git settings: Open Window/Preferences Team/Git/Configuration and add entries the necessary entries:


  • User Settings: Add and
  • File Formatting: Add core.autocrlf=input
  • Default pull strategy: Add branch.autosetuprebase=always
  • Auto prune on fetch: Add fetch.prune=true

Contributed text files are stored in the repository in the following way:

  • LF line endings
  • UTF-8 formatted
  • spaces instead of tabs

Formatting is done in eclipse with the .settings files linked to every project. Therefore, if everything is configured right, you do not need to worry about formatting.

Your git config file should contain the following entries:

       name = Full User Name
       email =
       autocrlf = input
       prune = true
       autosetuprebase = always

Make sure that the email is registered in Gerrit

If you are using multiple gerrit instances, make sure the email you use in the git settings is also registered in all gerrit instances (here the email is case sensitive). It is possible to register multiple emails in gerrit: Open to register a new email address. You will get an verification email containing a link. Clicking on the link does not always work, so just copy and paste it to the browser.

Getting the Sources

There are team project set files available for easier initial cloning. Import the project set with File->Import->Team->Team Project Set. Usually the Scout RT and Scout SDK are developed in different workspaces.

Alternatively you can also clone the sources manually (only experienced scout contributors should do this - beginners should use the team project sets).

Compiling in Eclipse

Scout RT

In order to compile everything you need to set the Target Platform. There are multiple target files available, because Scout needs to be compatible with multiple eclipse versions. In most cases you can use Open the file


and select Set as Target Platform.

Scout SDK

The SDK Plugins don't need a specific target. Instead Scout must be installed in the Eclipse IDE so that the SDK can use the commons plugin from Scout.

Furthermore there are compatibility fragments to abstract various Eclipse Platform API differences between the supported versions. Just close the ones that do not match the Eclipse version you are testing with (e.g. when developing with Eclipse Kepler, close all except 'org.eclipse.scout.sdk.compatibility.v43.fragment').

Using the sources with your Project

You can import the source projects in a workspace with your scout project. If a plugin is in the workspace and in the target, the one in the workspace is used (sometimes there are refresh problems).

Note: When a Scout project is created with the SDK, only the installed project is considered and not the target platform.

Gerrit Push Configuration

Although it is possible to push direclty to git, the common process is to push to Gerrit. We do this because

  • A build is triggered automatically after a commit. You will be notified when the build is started and completed. That way we make sure that no commits that break the build or tests are submitted unnoticed.
  • A commit can be reviewed and updated, if necessary.

In the previous step we imported the Scout repository read-only. To be able to push our feature branches and patches, we have to configure the Push URL to use Gerrit where write access is granted. Therefore we change the push URL to point to Gerrit:


[username] is your committer Id. Expand the Remotes directory, right-click on origin and select Gerrit Configuration....

GitContributionStep4.01.configure.push.url.png GitContributionStep4.02.add.gerrit.png

Click on Finish. Your Push URL should now look similar to


Common Git workflows

This section presents some of the current workflows when using Git.

Push a single commit to Gerrit

We want to modify something on develop branch

  • fetch the distant repository
  • create a branch my_change at the same position as origin/develop
  • activate the bug you want to work on in mylyn-task
  • modify the files to fix the bug
  • stage your changes
  • commit your stages changes with an appropriate message (Bug number, bug title, description, url of the bug, change-id). If you are using mylyn the message will be generated. Use the Gerrit integration button to add and generate a change id.
  • push to gerrit
  • open your gerrit change (use the gerrit integration in Eclipse).

If you are sure, your change is good:

  • review your change with someone and submit (+2)
  • fetch to check that everything was fine.

Otherwise read #Push a second version of your change

Git Tip
  • When you use git, you have a complete clone of the repository. When you commit, this is done locally. This exaplains why there is a second operation “push” that correspond to “send my commits” to another distant repository.
  • You files are in the working directory. When you modify a file, they are marked as “unstaged changes”. You can stage your modification. On commit only the staged changes will be considered.

Push a second version of your change

  • do an additional modification
  • stage and commit your changes. Choose the “Amend previous commit” option.
  • Push to gerrit
  • open your gerrit change: you should see the new version.
Git Tip
  • When you amend a commit, you are rewriting the history. Meaning: you are deleting one commit that you replace with another one. You should not rewrite a change that is published in a public branch:
    • you won’t be able to push it (unless you use -–force)
    • if someone as already worked on top of your previous commit, it will be a mess. He is working on top a commit that do not exist anymore.
  • amending a commit is fine when:
    • your commit only exist locally.
    • you are pushing it to gerrit to modify an open change. Thanks to the “change-id” line, gerrit will recognize that you want to create a second version of the same change.

Push a modification on somebody else change

  • find the change from somebody else that you should review
  • click on “Fetch…” button
  • checkout the change a new branch
  • like in #Push a second version of your branch amend the commit and push to gerrit

Cherry-pick a commit into another branch

The idea is to cherry pick a commit from develop to a release/3.9.1 branch

  • create a branch my_change_391 at the same position as origin/release/3.9.1
  • cherry-pick the commit you want to back port on this branch.
Git Tip
  • like every git operations the cherry-picking is applied on your working directory. This means that you need to be on the branch where you want the cherry-pick to be applied.

Rebase your local branch on to of develop

Assuming you has started a branch like in #Push a single commit to Gerrit but you have not finished at the time, and other developers have pushed commits on develop in between. You need to rebase.

  • checkout your branch
  • select origin/develop an choose “rebase”. This means “rebase your current branch on…”

If you haven’t any conflicts:

  • review you branch in the history view. The graph should show your branch on top of origin/develop


Git Tip
  • rebase modifies your current branch (you’re working directory). The other branch is not modified. This is good way to remember the branch you need to checkout and the branch where you need to click rebase on.
  • rebase also modify the commits. The same rules as for amend applies here.

Multiple commits on your feature branch

For work on bugs that require more time, you keep your working branch for a longer period of time

  • Start by creating a local branch to work on #Push a single commit to Gerrit
  • Create multiple commits to work on your bug
  • In case of new commits on the origin/develop branch merge origin/develop on your current branch:
    • fetch the origin remote
    • On origin/develop click on "merge" (this means "merge origin/develop on the current branch")
  • Create multiple commits to work on your bug

When your feature is ready:

  • merge origin/develop to get the latest commits
  • if you never backup your branch into an distant git repository create a second branch my_branch_backup. Do not checkout this new branch.
  • reset your branch on origin/develop with the option Soft. This will leave your working directory and your index untouched. But your branch my_branch is now pointing at origin/develop. This means that when you create a commit, the parent will be the last commit of origin/develop but with all the file modifications contained in your feature branch.
  • commit (do not forget the gerrit change id).
    • there is no differences between my_branch and my_branch_backup but the commit history. my_branch has only one parent commit (that is in origin/develop). my_branch_backup contains all the intermediate commits from your feature branch.
  • push this single commit (from your my_branch) to gerrit.

  • TODO: push your feature branch in a remote repository for backup
  • TODO: delete your branches
Git Tip
  • Do not let your feature branch diverge from the branch where you started and where you want to merge back at the end (develop in most of the cases). Regularly merge the branch into your feature branch.
  • Backup your branch. If you only commit in your local repository, your work will be lost if you mess with you git repository, or if your computer is stolen or broken. You need to push your feature branch to a distant repository.

Contributing Code

A common everyday workflow shown in the picture below. The steps that are always necessary are displayed in red.


When contributing features and patches you first need to think about on what release and branch it needs to be committed. An overview on branches is described here: Scout/Contribution_Guidelines#Git_Branching_Policy. A developer will usually one of the following:

  1. New feature: New features are only applied to the latest release. (If you think you have a "feature" that needs to be applied to a service release, let us call it hotfix.)
  2. Hotfix: An important bugfix that needs to be applied to the latest release and one or more older branches.
  3. Minor Bugfix: An minor bugfix that does not need to be applied to an older release.

The scenarios 1 and 2 are described here. 3 is done the same way as 1.

Contributing a new Feature

When you create a new feature you need to consider the following branches:

local branches:
 develop // local branch for HEAD
 <featureName>_<bugzillaid> //created by you for work in progress on your local machine
remote branches:
 develop // your feature ultimately needs to be pushed here
 features/<committerId>/<featureName>_<bugzillaid> //created by you for work in progress

For every new feature we create a new branch. We do that because

  • All changes of that feature are in the same place separate from the develop branch. We should have a better overview.
  • We can share it with other developers before it is complete. We can make sure that only complete features are pushed to the develop branch.
  • Working on multiple features in parallel is possible
  • It is not much additional overhead

Get the latest changes

Before we start we make sure we have the latest changes:

  • Checkout the local develop branch by double clicking it
  • Fetch the latest changes: Right-click the git repository and choose Fetch from Upstream
  • Pull: Right-click the git repository and choose Pull

Take a look at commit history (optional)

We can look at the commit history to see, if everything is as expected. Expand your local branches, right-click on develop and choose Show In -> History. We can see that our local 'develop branch (marked in green) refers to the same last commit as the remote develop branch shown as origin/develop in grey. GitContributionStep3.02.history.timeline.png

Create a local feature branch

We create and checkout a new local feature branch based on origin/develop with pull strategy None. We call the local feature branch description_bugzillaId, e.g. luna_target_bug412011.

Right-click on the commit where the origin/develop branch is pointing to and select Create Branch.... As Source ref or commit we select refs/remotes/origin/develop and call the local feature branch luna_target_bug412011. Select None as pull strategy and check Checkout new branch. Click on Finish. The feature branch should now be created locally.


The black checkbox icon on the left and the bold font in the History view indicate that the feature branch is currently active (checked out).


Commit changes to local feature branch

Now we do some changes and commit on the local feature branch.

In our example we made some initial changes for bug 412011 and are now about to commit a new file into the local branch. Switch to the view Git Staging. In the Unstaged Changes area all new and modified files are listed. We move the new to the Staged Changes area by using drag-and-drop and enter a commit message. GitContributionStep6.02.stage.and.enter.commit.message.png

Now we press the button Commit so that the target file will be committed into the local feature branch (Note: If we pressed the button Commit and Push, we would commit the target file into the local feature branch and also push those changes to the feature branch on the remote repository. However, we will do this step manually in this example).

If we look at the Commit History, we see that the local feature branch luna_target_bug412011 is 1 commit ahead of the remote feature branch origin/features/klee1/lunaTarget_bug412011.


Push changes to remote feature branch (Gerrit)

Now we push the recently created local feature branch to the remote repository on a remote feature branch. We do this to backup our work and allow other people to work on this feature. We also trigger a build on the sandbox hudson to verify the changes.

Right-click on the local feature branch luna_target_bug412011 and select Push to Gerrit.... The remote repository should already be the correct Gerrit Push URL. Press Next.

Now we choose the target ref name for the feature branch. The convention is as follow: The prefix refs/for indicates a special branch for Gerrit code review. The changes in the local feature branch will not directly be pushed into the feature branch of the remote repository. Instead, the changes are made available in Gerrit where code review can be done. In our example, the URL for code review is displayed Message Details box.

refs/heads/features/[committerID]/shortDescription_bug[ID], where [committerID] and [ID] should be replaced by the actual value. Press Finish and the feature branch should now be pushed onto the remote repository. There should be no error. GitContributionStep5.05.feature.branch.added.png

The feature branch is visible in the Remote Tracking directory.

Review Changes on Gerrit (feature branch)

This URL can be opened in a browser. The Sandbox Hudson will verify the supplied changes and set the verified flag if the build was successful.

After reviewing the code, the changes can be merged into the feature branch by clicking on the button Review and setting Code-Review +2 and IP-Clean to +1 and pressing Publish and Submit.


Switch back to EGit, right-click on the Scout RT Git repository and select Fetch from Upstream.


All branches will be fetched, i.e. our remote feature branch should be updated and be visible in the Commit History (Note: For the sake of simplicity we removed all irrelevant branches from the remote tracking folder). Currently, the local feature branch and the remote feature branch point to different commits, however they both contain the same changes. Therefore, we are going to rebase our local feature branch on top of the remote feature branch. Right-click on the remote feature branch and select Rebase on Top of.


The local feature branch and remote should now point to the same commit ID.


Apply commits from feature branch to develop

Before we apply our changes from the feature branch to the develop branch (currently the Scout Luna branch), we decide to make some further changes, commit them into the local feature branch and push them to Gerrit again (please repeat step 6). The new changes for our example are available here. As before, we review and apply these changes into the remote feature branch resulting the Commit History view to display something like this:


We now have two commits in our feature branch (remote and local) and both of them will be applied to to the origin/develop branch as 1 commit, i.e. in the Git context we squash our 2 commits from the feature branch into 1. To achieve this goal we reset our local feature branch luna_target_bug412011 to the remote origin/develop branch by right-clicking and select Reset -> Mixed (HEAD and Index).


Reset-Mixed means that the changes from the feature branch will be made available as Unstaged Changes. In the Git Staging perspective we move the changes to the Staged Changes area and commit them locally.


The Commit History looks like:


Rebase branch develop to origin/develop and Push to Gerrit


The local feature branch luna_target_bug412011 is now 1 commit ahead of the origin/develop branch, so we push this commit to Gerrit as follows: Select Push to Gerrit... and configure the dialog like this:

Review Changes On Gerrit (brach develop)

Hit Ctrl+Space in the Gerrit Branch field and choose develop branch, select refs/for/ in the drop-down field. After a successful code review at Gerrit, we apply this change into the remote develop branch.

After fetching the remote branches the Commit History should now display a new commit on the origin/develop branch.


Delete Obsolete Feature Branches

Not possible at the moment. See

Contributing a new Hotfix

When you create a new Hotfix you need to consider the following branches:

local branches:
 develop // local branch for HEAD
 release/x.y.z // local branch for service release (e.g. releases/3.9.1)
 <hotfixName>_<bugzillaid> //created by you for work in progress on your local machine
remote branches:
 develop // your feature ultimately needs to be pushed here
 release/x.y.z // local branch for service release (e.g. releases/3.9.1)
 hotfix/<committerId>/<hotfixName>_<bugzillaid> //created by you for work in progress

When you create hotfixes you start as described with features, but instead of your remote feature branch your branch is now called hotfix. You do all the steps to push the change to develop and as a last step cherry-pick the change to the release branch.

Apply commit from develop to release branch(es)

Assume that the changes from the previous feature branch should also be applied to a release branch, e.g. release/3.9.1. Since we squashed our feature branch commits into the develop branch, we can just cherry pick that commit from the develop branch.

To do this checkout origin/release/3.9.1 to a local branch by right-clicking on the origin/release/3.9.1 and select Create Branch...


The local branch will be named release/3.9.1.


Press Finish and a new local branch should be visible and active.

We will now pick the commit from origin/develop that we would also like to have in our release branch 3.9.1. Right-click on the commit f3ea51c and select Cherry Pick.


The changes are automatically applied and committed to the local release branch.


As explained in step 7, we can push these changes to Gerrit. Right-click on the Scout RT Git repository and select Push to Gerrit... Enter release/3.9.1 in the Gerrit Branch field ans select refs/for/ as before.

Press Finish and follow the same procedure as described in step 7 for applying the changes in Gerrit to the remote release branch. Note: We abandon the change since this feature is only intended for Scout 3.10 and not for the release branch 3.9.1. However, the main message how to apply changes from the develop to a release branch should be clear.

Changing the API

If you need to change the Eclipse Scout API, keep a few things in mind:


Whenever possible don't physically delete classes with your change, instead set them to deprecated, to give other developers time to migrate. The newly deprecated class should have the following information:

1) Migration note in the javadoc, so that developers know what to use instead, e.g. "@deprecated Use {@link fooImproved()} instead."
2) Release when the deprecated class will be removed, e.g. "will be removed with XY release"

An example is illustrated below:

*@deprecated Will be removed in the M-Release. Use {@link fooImproved()} instead.
public void foo() {

Also add a migration note to the bugzilla ticket.


How to Fetch a change from Gerrit

If somebody has pushed a change to Gerrit, and you like to modify something (push a new Patch set for the change), a good way is to fetch this change into a local branch. You can amend the commit and push it back to Gerrit.

With the Gerrit Mylyn Integration

  • Open the Task representing the change (do not mix it with the task representing the bug).
  • Expand the patch set you want to fetch
  • At the bottom of the section, you will find a “Fetch Bottom”

Gerrit Mylyn Fetch Change.png

  • In the dialog “Fetch a change from Gerrit”, select “create and checkout a local branch” and provide a name that you can work with (for example: bug417010_bookmark_service_v2)

Fetch a change from Gerrit Dialog.png

Without the Gerrit Mylyn Integration

  • Go on the Gerrit Website, open the change
  • Expand the patch set you want to fetch
  • In the download row of the summary table, select “checkout” and copy the command line into the clipboard (use the small icon to do it).

Gerrit Copy Download Command.png

  • Back in Eclipse, in the Git Repository View, select the Git Repository.
  • In the context menu select “Fetch from Gerrit…”

Fetch from Gerrit Menu.png

  • The dialog “Fetch a change from Gerrit” pops up and it should parse the values from your clipboard.
  • select “create and checkout a local branch” and provide a name that you can work with (for example: bug417010_bookmark_service_v2)

Fetch a change from Gerrit Dialog.png

How do I keep my feature branch up to date?

Back to the top