Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Icon

The Asterisk project is currently undergoing a migration from Subversion to Git. As a result, this page is still a work in progress.

Overview

The Asterisk project uses Gerrit for code reviews, continuous integration validation, and git management. When creating a patch to Asterisk or its various related projects, all patches should be pushed to Gerrit for review.

Use of Gerrit is beyond the scope of this wiki page - for in depth information, see the Gerrit documentation.

Creating an Account

Gerrit uses OpenID in conjunction with the Asterisk project's Atlassian infrastructure to provide single sign-on. If you already have an account in the Asterisk project infrastructure (such as JIRA) and have signed a Contributor License Agreement, you should be able to sign in to Gerrit automatically.

  1. Create an account at signup.asterisk.org.

  2. Sign a Contributor License Agreement.

    Icon

    Until your Contributor License Agreement is approved, you will not be able to sign into the project OpenID provider or Gerrit.

  3. Browse to Gerrit, and click Sign In.

  4. This will redirect to openid.asterisk.org. Sign in with your Atlassian username/password.

  5. Upon signing in successfully, you will need to authorize Gerrit to access your OpenID. When you have done so, you should be redirected back to Gerrit, and will be signed in.

On this Page

Setting up your Gerrit Account

Upon logging in for the first time, you will need to perform the following:

  1. Set your username for your account. This can be any username, although we highly recommend matching your Atlassian username. To set your username:
    1. Click on your name in the top-right corner.
    2. Click "Settings"
    3. Click "Profile" on the left side of the screen.
    4. In the top text box in the center, enter your user name, and confirm.
  2. Add your SSH public key.

Cloning from Gerrit

While access to the underlying git repository is open to anyone via anonymous HTTP access, this guide will assume that you want to push changes up as well. For that, Gerrit uses SSH. If you are only looking to obtain the source code for a particular repository, you may just use the HTTP methods shown below.

  1. Clone the repository:
    1. SSH:

    2. HTTP:

    3. Anonymous HTTP:

  2. Copy the commit-msg hook into your local .git/hooks folder:

    1. If you have git-review installed:

    2. Otherwise:

      The commit-msg hook adds the Change-Id automatically to git commit messages. A Change-Id is necessary for Gerrit to associate multiple patch sets together. For more information, see Change-Ids.

Creating an SSH Alias

Since access to gerrit.asterisk.org is likely to occur often, you may want to set up an SSH alias:

This will allow you to access the repository as shown below:

Pushing to Gerrit for Code Review

Use git review

  1. Install git-review:

  2. To submit a change to master as a draft:

  3. To submit a change to master:

    Note that this will automatically publish the change to the asterisk-dev mailing list!

  4. To submit a change for a particular branch:

  5. To submit a change, including the ASTERISK issue:

Use git push

Pushing to Gerrit for code review can always be done using standard git commands. This is done by pushing to the refs/for/[branch]. Generally, this will be master, unless pushing to a particular mainline Asterisk branch.

Updating a Review

  1. Reviews are automatically updated so long as commits contain the same Change ID. If your review has any findings, rebase the commits as appropriate, making sure the Change ID is preserved:

  2. Re-push the changes:

    or:

    Icon

    There is a git/gerrit incompatibility between certain versions that may cause a review/push command to fail with "unpack failed: error Missing tree" when the commit was amended and only the commit message changed. To work around this error, add --no-thin to the push command.

Troubleshooting

git-review

Problem: attempting to run git review results in something like the following:

Traceback (most recent call last):
  File "/usr/local/bin/git-review", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.6/dist-packages/git_review/cmd.py", line 1132, in main
    (os.path.split(sys.argv[0])[-1], get_version()))
  File "/usr/local/lib/python2.6/dist-packages/git_review/cmd.py", line 180, in get_version
    provider = pkg_resources.get_provider(requirement)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 176, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 648, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: git-review

Solution: Run

sudo pip install --upgrade setuptools

on your command line

  • No labels