Contribute and Review on Android Code

Registry on Gerrit

Android code review site: http://review.source.android.com

The site base on Gerrit.Gerrit is a web based code review system, facilitating online code reviews for projects using the Git version control system.

To submit your changes of Android code for public repository and code review, you need first register on the site using you google account.

  1. Acquire a google mail account: http://mail.google.com
  2. Register a gerrit account with your gmail.
  3. Provide the public RSA/DSA ssh pub key.
  4. Select a username and fill up other personal informations.
  5. Assign the agreement and provide your contact information.

Provide the public RSA/DSA public key

cd ~/.ssh
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub

Then copy the content of the public key file, and it into Gerrit's web interface.

To verify:

ssh -p 29418 Justin@review.source.android.com

and the message returns:

gerrit: no shell available
Connection to hostname closed.

curl https://review.source.android.com/ssh_info

the review website address returns:

review.source.android.com 29418

This is what repo use to upload the code.

Change Git Configuration

git config --global user.name="Justin"
git config --global user.email="Justin@gmail.com"

Repo will use the 'Justin' part in the user email. It is better to keep user name same as email account.

This will modify the ~/.gitconfig, if without --global option, the command will modify the .git/config file.

Upload Code for Review

The Git-Push Method

cd frameworks/base
git push ssh://Justin@review.source.android.com:29418/platform/frameworks/base HEAD:refs/for/master

From above command line, we need to get the following information before to push the code:

The Repo Method

repo upload frameworks/base

Where does it push?

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote name="korg"
            fetch="git://android.git.kernel.org/"
            review="review.source.android.com" />
  <default revision="gingerbread"
            remote="korg" />

  <project path="build" name="platform/build">
    <copyfile src="core/root.mk" dest="Makefile" />
  </project>
  <project path="bionic" name="platform/bionic" />
  <project path="bootable/bootloader/legacy" name="platform/bootable/bootloader/legacy" />

  ... ...
</manifest>

All in one, this is the equivalent command line for the above repo upload command:

git push --receive-pack=gerrit receive-pack ssh://Justin@review.source.android.com:29418/platform/frameworks/base refs/heads/test_branch:refs/for/gingerbread
Wiki comments powered by Disqus