Chapter 4. Sourcecode and Review

Table of Contents

Version Control with Git
Introduction to Git
Git clone with EGit (textual)
Git clone with EGit (graphical)
Configuring Git for Gerrit
Creating an SSH key
Setting your name and email address
Register on Gerrit
Signing up using OpenID
Making a review
Submitting a change
Summary
System Overview

We are using Git to manage our source code, Jenkins for continuous integration and Gerrit for the code review. We assume that you understand the benefits of version control, continuous integration and code review but you might not know the specific utilities. This chapter should help you find out how they are integrated and how you are going to use them.

You will need to get the source code from our main git repository. After you have completed modifications to the source you can create local commits. Your commits can be pushed to a repository you own or you can push them into the Gerrit code review system. This will result in Gerrit creating a Chase and will lead to the Jenkins server being triggered and asked to compile and test your commits. The result will be returned to Gerrit. Your teammates are asked to make reviews of your. You are asked to modify your change until both the Jennkins result and the feedback of your teammates is positive. Your commits will be automatically integrated into the main repository.

Version Control with Git

Introduction to Git

Git is a modern and widely used version control system. We assume that you have already worked with another version control system and will solely focus on some Git basics and how this is can be used in the context of Saros. The central concept is a Git Repository, it is located in the .git/ subdirectory and holds the entire history of the project (branches, commits, all versions of files). The Git checkout command takes a specific revision from your local repository and updates, adds and removes files from your Git working directory to match the state of that revision. Git commit allows you to create a local commit that will be stored in your local Git Repository. The Git Index is a unique concept that represents the state that will be used for the next commit. You will mostly use it to add a new file, remove an existing one. An advanced usage of the Git Index is to partially add modifications of a file to the index, in the beginning you will probably not want to use that specific feature though. Git allows you to create local branches that are branched off any Git commit that is already in the local Git Repository. In case you created a Git Commit too quickly you can always amend to the last one. Once you want to share your changes you will need to Git push, this will move your local changes to the remote Git Repository. To get changes from a remote Git Repository you will need to use the Git pull. This will transfer all commits from the remote repository to your local one and it will try to move your changes to the top of the history. The last operation is called a Git rebase.

There are plenty of Git introductions available on the web, some describe the technical details, some are for people coming from Subversion, some show how to use the Eclipse integration. The Git website has a documentation section with links to good documentation. If the following guide is not enough you should be able to find information there.

Git clone with EGit (textual)

EGit Plugin versions

The below procedure was tested with Eclipse 3.7.1 and EGit plugin version 1.3.0.201202151440-r.

Procedure 4.1. Git clone Saros

  1. Begin

    FileImport

  2. Select import from Git

    Select GitProjects from Git and press Next.

  3. Select Repository Source

    Select URI and press Next.

  4. Source Git repository

    Fill in dpp.git.sourceforge.net as Host, use gitroot/dpp/saros as repository path and select git as the protocol and finish by pressing the Next button.

  5. Select the branch

    Select the master branch and continue by pressing Next.

  6. Select local destination

    Decide where to store the cloned Git repository. The proposed directory should work and press Next.

  7. Cloning the repository

    Progress of downloading the repository is shown.

  8. Select project directory

    Select Import existing projects and import the top level directory Working Directory and continue using the Next button.

  9. Import projects

    Select at least the de.fu_berlin.inf.nebula and Saros to import.

  10. Switch to Git Perspective

    Clicking on Window+Open PerspectiveOther and select the Git Perspective.

  11. Enter Gerrit Configuration

    Unfold the Saros, Remotes and origin folder. Use the context menu and select Gerrit Configuration.

  12. Configure Gerrit

    Use ssh://saros-build.imp.fu-berlin.de:29418/saros.git as the Push URI and refs/for/master as the Destination branch.

  13. Verify EGit is enabled

    Switch to the Java Perspective and use the context menu in the Package Explorer and verify that the Team contains options for commit.

Git clone with EGit (graphical)

Procedure 4.2. Git clone Saros

  1. Begin

  2. Select import from Git

  3. Select Repository Source

  4. Source Git Repository

    Host: dpp.git.sourceforge.net, Path: gitroot/dpp/saros

  5. Select the branch

  6. Select local destination

  7. Cloning the repository

  8. Select project directory

  9. Import projects

  10. Switch to the Git Perspective

  11. Switch to the Git Perspective

  12. Enable Gerrit

  13. Configure Gerrit

    Use saros-build.imp.fu-berlin.de and refs/for/master

  14. Verify EGit being used in the Java Perspective