Skip to content

User: Introduce to gerrit options

ccc edited this page Sep 30, 2018 · 2 revisions

krep supports Gerrit as the default git server, and there's no other server planed to support.

Gerrit supports ssh with the default port 29418 to operate registered git repositories, which is used by krep to list repositories and create repistories. It's the mandatory requirement for krep to work with gerrit.

As mentioned, there're two main operations for krep to work on gerrit git repositories. gerrit ls-projects is used by krep to secure the exitence of the working remote repositories and wasn't be exported by the user. gerrit create-project is the command to users to create a git repository on the gerrit.

NOTE: full options can be fetched by ssh command gerrit create-project --help.

krep support the gerrit create-project options with the extra-option. It can be found inside the output help of krep git-b --help or other sub-commands with Gerrit.

Gerrit options for create-project:
  gerrit-cp:branch              initial branch name
  gerrit-cp:empty-commit        to create initial empty commit
  gerrit-cp:description         description of project
  gerrit-cp:owner               owner(s) of the project
  gerrit-cp:parent              parent project

To create the gerrit git repository with options, the command line could be:

$ krep git-b ... \
    --repo-create \
    --extra-option "gerrit-cp:empty-commit" \
    --extra-option "gerrit-cp:description=\"Mirror of ...\"" \
    --extra-option "gerrit-cp:parent=All-External-Projects" \
    ...

The command equals the gerrit command line like:

$ ssh -p 29418 gerrit create-project ... \
    --empty-commit \
    --description "Mirror of ..." \
    --parent All-External-Projects \
    ...

NOTE: It's a good manner to create the empty commit with the option gerrit-cp:empty-commit for other branch to be created from the first initial commit without any modification.

NOTE: existent option --description has been substituted by gerrit-cp:description and will be removed later.