Cosium / vet

Gerrit client using pull request workflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Maven Central Latest

vet

Vet allows to review code on Gerrit using a pull-request workflow similar to GitHub, GitLab, Bitbucket and others.

CLI installation

Vet CLI is self sufficient. There is no need to deploy a separate java runtime to make it work.

Linux - Debian based distributions

$ wget https://github.com/Cosium/vet/releases/download/3.22/vet-linux_x64.deb.zip -O vet.deb.zip \
&& unzip vet.deb.zip \
&& sudo dpkg -i vet.deb \
&& source /etc/bash_completion.d/vet_completion.sh \
&& rm vet.deb.zip vet.deb

Mac OSX - Homebrew

$ brew tap cosium/vet && brew install vet

Windows - Chocolatey

$ choco install gerrit-vet

Manual

Download the binaries from https://github.com/Cosium/vet/releases

JetBrains IDE plugin

Compatible with: IntelliJ IDEA, PhpStorm, WebStorm, PyCharm, RubyMine, AppCode, CLion, GoLand, DataGrip, Rider, MPS, Android Studio.

https://plugins.jetbrains.com/plugin/10748-vet

Benefits

No more commit amend

Gerrit can't manage more than one commit per change set.
Because of that, the widespread and cumbersome workflow is to have a single local commit and amend it every time you want to update the changeset.

Using Vet, Gerrit keeps seeing one commit per change set while you don't have to rewrite your history anymore.
Each time you will ask to push to Gerrit, Vet will forge and push a single commit based on your source branch commit sequence.

No pre commit hook needed

Vet computes the Gerrit change id on the fly before pushing to Gerrit.
Say bye to the pre-commit script.

No Gerrit REST or SSH api involved

Git is the only channel used by Vet to communicate with Gerrit.
Vet doesn't need to know your credentials.

Use any git remote protocol

Because Vet delegates all Gerrit communication to git, your remote access protocol is only limited by git:

  • file
  • ssh
  • http(s)
  • ...

Usage

help

$ vet --help
usage: vet [--version] [--help] <command> [<args>]

<command> can be one of:
 new, checkout-new, checkout, push, untrack, status, pull, fire-and-forget

Debug options:
 --stacktrace      Print stacktraces
 --verbose         Enable verbose mode

Vet: The Gerrit client using pull request review workflow

checkout-new

$ vet --help checkout-new
usage: vet checkout-new [-b <branch>] [-f]
 -b,--checkout-branch <branch>   The branch that will be created to track
                                 the change.
 -f,--force                      Forces the execution of the command,
                                 bypassing any confirmation prompt.
Creates a new change and tracks it from a new branch

checkout

$ vet --help checkout
usage: vet checkout [-b <branch>] [-f] [-i <id>] [-t <branch>]
 -b,--checkout-branch <branch>   The branch that will be created to track
                                 the change.
 -f,--force                      Forces the execution of the command,
                                 bypassing any confirmation prompt.
 -i,--numeric-id <id>            The numeric id of the change.
 -t,--target-branch <branch>     The target branch of the change.
Tracks an existing change from a new branch

push

$ vet --help push
usage: vet push [-f] [-p] [-s <subject>] [-v <vote>] [-w]
 -p,--publish-drafted-comments      Publish currently drafted comments of
                                    the change if any.
 -s,--patchset-subject <subject>   The subject of the patchset.
 -v,--code-review-vote <vote>       Vote on code review. i.e. +1 is a
                                    valid vote value.
 -w,--work-in-progress              Turn the change to work in progress
                                    (e.g. wip).
Uploads modifications to the currently tracked change

fire-and-forget

$ vet --help fire-and-forget
usage: vet fire-and-forget [-f] [-v <vote>]
 -f,--force                     Forces the execution of the command,
                                bypassing any confirmation prompt.
 -v,--code-review-vote <vote>   Vote on code review. i.e. +1 is a valid
                                vote value.
Creates a new untracked change then resets the current branch to change

new

$ vet --help new
usage: vet new [-f] [-t <branch>]
 -f,--force                    Forces the execution of the command,
                               bypassing any confirmation prompt.
 -t,--target-branch <branch>   The change target branch.
Creates a new change and tracks it from the current branch.

pull

$ vet --help pull
usage: vet pull

Pulls modifications of the currently tracked change

status

$ vet --help status
usage: vet status

Displays the current status

untrack

$ vet --help untrack
usage: vet untrack [-f]
 -f,--force   Forces the execution of the command, bypassing any
              confirmation prompt.
Untracks any tracked change

track

$ vet --help track
usage: vet track [-b <branch>] [-f] [-i <id>] [-t <branch>]
 -i,--numeric-id <id>            The numeric id of the change.
 -t,--target-branch <branch>     The target branch of the change.
Tracks an existing change from the current branch

Library

You will need JDK 9+.

<dependency>
   <groupId>com.cosium.vet</groupId>
   <artifactId>vet</artifactId>
   <version>${vet.version}</version>
</dependency>

Build

You will need to have Docker installed to build the project.

Generating standalone binaries

Vet uses Java 9 Jlink to generate standalone binaries for Linux, MacOSX and Windows.

$ ./gradlew binaries

Generated binaries can be found in build/binaries

About

Gerrit client using pull request workflow

License:MIT License


Languages

Language:Java 92.4%Language:Kotlin 4.4%Language:Shell 2.7%Language:Dockerfile 0.4%Language:PowerShell 0.1%