Traballar amb Gerrit

Account setup

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

  2. També haurà de [carregar una clau SSH]https://review.jami.net/settings/#SSHKeys) per poder cometre canvis per a revisió.

  3. No oblideu seleccionar un nom d’usuari.

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

Important

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 <nom d'usuari>@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.

Per actualitzar la configuració

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

git set-url d'origen remot ssh://<username>@review.jami.net:29420/<project_name>

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

O clonar el repositori existent si vols començar de nou.

Per empènyer per defecte en ref/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

Per crear la revisió

Quan es puja a aquesta branca màgica, es crearà automàticament una revisió sobre Gerrit.

git impulsar l'origen TRE:refs/for/master

Si ha configurat el default per refs/for/master com es descriu anteriorment, simplement

git empujar

Si HEAD actualment apunta a la branca amb els commits que desitges empujar. Idealment, hauria de treballar en una branca de característiques/bug per al problema en qüestió. Llavors pots fer:

git empujar origen <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.

Per exemple, pots voler un telecomàndit «privat» per empurrar a; obrir <project_dir>/.git/config i afegir:

[remote "private"]

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

Després:

git empujar privat

El treball privat és el mateix que els patchets, excepte que no són visibles per a altres per defecte i no desencadenen cap construcció de Jenkins.