Code Monkey home page Code Monkey logo

vet's Introduction

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

vet's People

Contributors

reda-alaoui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vet's Issues

windows: vet push error if last commit contains quoted space

If the last commit contains " character, vet push fails with the following message:

fatal: Not a valid object name <part of the commit message without the text between " characters>

Source-Branch: feature/local-branch-name
Vet-Version: 1.13
Change-Id: xxxxxxxxxxxxxxxxxxx
'git commit-tree xxxxxxxxxxxxxx -p xxxxxxxxxxxx -m <commit message>

Source-Branch: feature/local-branch-name
Vet-Version: 1.13
Change-Id: xxxxxxxxxxxxxxxxxxxxx' failed with code 128

Mac: `fork: Resource temporarily unavailable` when running vet

Issue

When running vet --help or any other vet command, there is a delay followed by:

/usr/local/Cellar/vet/64/bins/vet: fork: Resource temporarily unavailable

During the run, my CPU spikes to about 25-50% usage compared with <10% on idle.

System Info

  • Installed using brew tap cosium/vet && brew install vet
  • macOS 10.13.6

What I've tried

I tried reinstalling from brew, and I tried rebooting my system in between. I have not tried installing from other means.

Wrong message while pushing on a remote branch that is not checkout on local

In order to push on a previous remote branch, the user has to checkout the associated remote branch first. If it hasn't been done, there is the following message :

No remote found for branch 'your branch'

This message does not properly explain the real reason of the problem, therefore it has to be changed into something more explicit.

Unknown protocol ssh

Fresh install of vet on Ubuntu. Using ssh as protocol for communicating with gerrit, but get the following error on most commands:

vet status --verbose --stacktrace
16:41:01 INFO com.cosium.vet.App - Stacktrace printing enabled
16:41:01 INFO com.cosium.vet.App - Verbose mode enabled
16:41:01 DEBUG com.cosium.vet.command.CompositeCommandArgParser - Parsing arguments [status]
16:41:01 DEBUG com.cosium.vet.command.CompositeCommandArgParser - Parsing command using com.cosium.vet.command.status.StatusCommandArgParser@39aeed2f
16:41:01 DEBUG com.cosium.vet.runtime.BasicCommandRunner - Executing 'git config remote.origin.pushurl'
16:41:02 DEBUG com.cosium.vet.git.BasicGitClient - No value found for 'remote.origin.pushurl'. Falling back on 'remote.origin.url'
16:41:02 DEBUG com.cosium.vet.runtime.BasicCommandRunner - Executing 'git config remote.origin.url'
16:41:02 DEBUG com.cosium.vet.runtime.BasicCommandRunner - ssh://[email protected]:29418/path/to.project

16:41:02 ERROR com.cosium.vet.App - java.net.MalformedURLException: unknown protocol: ssh
java.lang.IllegalArgumentException: java.net.MalformedURLException: unknown protocol: ssh
at com.cosium.vet/com.cosium.vet.git.RemoteUrl.toURL(Unknown Source)
at java.base/java.util.Optional.map(Unknown Source)
at com.cosium.vet/com.cosium.vet.gerrit.DefaultChangeRepositoryFactory.build(Unknown Source)
at com.cosium.vet/com.cosium.vet.command.status.StatusCommand$Factory.build(Unknown Source)
at com.cosium.vet/com.cosium.vet.command.status.StatusCommandArgParser.parse(Unknown Source)
at com.cosium.vet/com.cosium.vet.command.CompositeCommandArgParser.parse(Unknown Source)
at com.cosium.vet/com.cosium.vet.Vet.run(Unknown Source)
at com.cosium.vet/com.cosium.vet.App.main(Unknown Source)
Caused by: java.net.MalformedURLException: unknown protocol: ssh
at java.base/java.net.URL.(Unknown Source)
at java.base/java.net.URL.(Unknown Source)
at java.base/java.net.URL.(Unknown Source)
... 8 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.