Trabalhar com o Gerrit

Account setup

  1. Sign in with your Google, GitHub, or git.jami.net account.

  2. Também precisa de carregar uma chave SSH para poder fazer commit das alterações para revisão.

  3. Não se esqueça de selecionar um nome de utilizador.

  4. Finally, the email address specified in your git config must match one of the email addresses registered with your Gerrit account.

Importante

For Savoir-faire Linux Inc. employees: please continue to use your @savoirfairelinux.com email address.

To view your Git config

git config --list

To test your SSH access

To check that your SSH access is properly set up, run the following command:

ssh -p 29420 <nome_de_utilizador>@review.jami.net

is your Gerrit username that you should have set during the account creation. If not, you can do that here.

If your access is granted, you should see a message like:

****    Welcome to Gerrit Code Review    ****

Hi, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
  To clone a hosted Git repository, use:

  git clone ssh://<username>@review.jami.net:29420/REPOSITORY_NAME.git

Connection to review.jami.net closed.

Git configuration

Gerrit is the official Git repository.

Para atualizar a configuração

You must update your remote information to now use the Gerrit repository. To do that, update your origin URL:

git remote set-url origin ssh://<nome_de_utilizador>@review.jami.net:29420/<nome_do_projeto>

Replace <project_name> with the correct project (example: jami-daemon).

Ou clone o repositório existente se quiser começar de novo.

Para fazer enviar / push por predefinição em refs/for/master

You can configure Git to automatically create a review when a change is pushed.

git config remote.origin.push HEAD:refs/for/master

Para criar a revisão

Ao fazer push para este ramo mágico, será criada automaticamente uma revisão no Gerrit.

git push origin HEAD:refs/for/master

Se configurou a predefinição para refs/for/master como descrito acima, basta

git push

Se HEAD aponta atualmente para o ramo com os commits que gostaria de enviar. Idealmente, deve trabalhar num ramo de funcionalidades/bug para o problema em questão. Então pode fazer:

git push origin <bugfix_branchname>:refs/for/master

If this is the first time you’ve pushed, you will be prompted to install a post-commit hook to insert a Change-ID in your commit message. Gerrit needs this to track patch sets and will reject pushes until you install it. Simply copy and paste the command to install the hook as instructed by Gerrit and amend your commits.

To push a private patch

You can push a work in progress (a.k.a. draft) by pushing to refs/for/master%private.

Por exemplo, pode querer um remoto “privado” para o qual fazer push; abra <project_dir>/.git/config e adicione:

[remote "private"]

    url = ssh://<username>@review.jami.net:29420/jami-daemon
    push = HEAD:refs/for/master%private

Então:

git push private

O trabalho privado funciona da mesma forma que os conjuntos de patches, exceto que, por predefinido, não são visíveis para os outros e não ativam quaisquer compilações Jenkins. Um rascunho pode então ser partilhado ou publicado.