Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
Tip

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.

    Warning

    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.

Column
Panel
titleOn this Page

Table of Contents
maxLevel23

Setting up your Gerrit Account

...

  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:

    Code Block
    $ git rebase -i
  2. Re-push the changes:

    Code Block
    $ git review

    or:

    Code Block
    $ git push asterisk:{repo} HEAD:refs/for/master

Branch Cherry-Picking

Patches being submitted to the project must be cherry-picked to other branches when either:

  • The patch is a bug fix. In this case, the patch should be cherry-picked to all supported branches that have the bug.
  • The patch is a new feature or improvement, and tests have been written to cover the new feature or improvement. In that case, the patch may be submitted to other supported branches.

    Note

    Not all changes are appropriate for all branches. See Software Configuration Management Policies for more information. If you have questions about whether or not a change is appropriate for a particular branch, feel free to ask on the asterisk-dev mailing list or in #asterisk-dev.

Cherry-picking can be done either when a patch is first proposed, or it may be done when the patch has been reviewed but prior to it being submitted. If you plan on cherry-picking after an initial review, please indicate so in a comment on the review.

Cherry-Picking in Gerrit

If your patch applies cleanly to a branch, you can cherry-pick directly in Gerrit. On your review, select the Cherry-Pick button:

Image Added

In the resulting dialog, enter the branch you want to cherry-pick to, then select Cherry Pick Change.

Image Added

If the change merges cleanly, a new review will be opened with your cherry-picked change. If the change could not be merged, and error will appear and you will need to use one of the manual methods listed below.

Cherry-Picking using git review

If you have already submitted a patch for review, you may cherry pick to a new branch using git review:

Code Block
# git review --cherry-pick {review id} {origin branch}

As an example, if we previously posted for review a code change for Asterisk 11, and the Gerrit Review ID is 30, we might use the following for Asterisk 13:

Code Block
# git review --cherry-pick 30 13

Cherry-Picking using git cherry-pick

You may cherry pick using git cherry-pick as well. When performing the cherry-pick using git, make sure that the Change-Id header is the same between all branches.

As an example, if we committed the following to Asterisk 13:

Code Block
commit dc8f87145c352c1bcf1a3361802aac26da5f50e2
Refs: review/asteriskteam/file-version-13, file-version-13
Author:     Asterisk Development Team <[email protected]>
AuthorDate: Sun Apr 12 12:59:22 2015 -0500
Commit:     Asterisk Development Team <[email protected]>
CommitDate: Sun Apr 12 20:20:19 2015 -0500

    git migration: Remove support for file versions

    Git does not support the ability to replace a token with a version
    string during check-in. While it does have support for replacing a
    token on clone, this is somewhat sub-optimal: the token is replaced
    with the object hash, which is not particularly easy for human
    consumption. What's more, in practice, the source file version was often
    not terribly useful. Generally, when triaging bugs, the overall version
    of Asterisk is far more useful than an individual SVN version of a file.
    As a result, this patch removes Asterisk's support for showing source file
    versions.

	ASTERISK-12345

    Change-Id: Ia932d3c64cd18a14a3c894109baa657ec0a85d28

We could then cherry pick this back to Asterisk 11 using the following:

Code Block
$ git cherry-pick dc8f87145c352c1bcf1a3361802aac26da5f50e2

The resulting commit must have the same Change-Id as the Asterisk 13 commit for Gerrit to recognize that this is a cherry-picked commit:

Code Block
    Change-Id: Ia932d3c64cd18a14a3c894109baa657ec0a85d28

When posting it for review to Gerrit, you should also use the same topic as the original patch. Generally, this is the ASTERISK issue.

Code Block
$ git review -t ASTERISK-12345 11

 

Troubleshooting

git-review

...