All Projects → shanesmith → gerrit-cli

shanesmith / gerrit-cli

Licence: MIT license
Gerrit in your command lines.

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to gerrit-cli

go-gerrit
Go(lang) client/library for Gerrit Code Review
Stars: ✭ 68 (+74.36%)
Mutual labels:  code-review, gerrit
sonar-gerrit-plugin
SonarQube plugin for posting issues as Gerrit review comments
Stars: ✭ 32 (-17.95%)
Mutual labels:  gerrit
z-pot
project overview tool, used to analyze the amount of code, the number of files, code statistics and so on.
Stars: ✭ 18 (-53.85%)
Mutual labels:  code-review
dispatch
🦀 Dispatch makes sure pull requests within a GitHub organization get reviewed by the right people.
Stars: ✭ 22 (-43.59%)
Mutual labels:  code-review
localhost-sonarqube
Analysing source code locally with SonarQube in a Docker environment.
Stars: ✭ 17 (-56.41%)
Mutual labels:  code-review
clang-tidy-review
Create a pull request review based on clang-tidy warnings
Stars: ✭ 33 (-15.38%)
Mutual labels:  code-review
effective-code-review
Presentation about my process for making code reviews as effective as possible
Stars: ✭ 63 (+61.54%)
Mutual labels:  code-review
reviewio
code review stats for
Stars: ✭ 22 (-43.59%)
Mutual labels:  code-review
gerritbot-rs
Cisco Teams bot for Gerrit code reviews.
Stars: ✭ 13 (-66.67%)
Mutual labels:  gerrit
FastLint-Issues
FastLint finds & fixes bugs in your commits
Stars: ✭ 123 (+215.38%)
Mutual labels:  code-review
gerrit-css-theme
Clean and modern CSS theme for Gerrit.
Stars: ✭ 21 (-46.15%)
Mutual labels:  gerrit
dx-scanner
CLI tool that allows you to measure quality of a team work and an app based on your source code.
Stars: ✭ 79 (+102.56%)
Mutual labels:  code-review
WikiContrib
A tool for Wikimedia community members to visualize their technical contributions
Stars: ✭ 21 (-46.15%)
Mutual labels:  gerrit
gh-code-review-assistant
(no longer maintained) GitHub Code Review Assistant tool is a userscript (lightweight extension) for Firefox / Chrome
Stars: ✭ 29 (-25.64%)
Mutual labels:  code-review
critiq.vim
Github code reviews from Neovim
Stars: ✭ 69 (+76.92%)
Mutual labels:  code-review
code-review
Automated static analysis & linting bot for Mozilla repositories
Stars: ✭ 51 (+30.77%)
Mutual labels:  code-review
phinder
PHP code piece finder
Stars: ✭ 54 (+38.46%)
Mutual labels:  code-review
rview
A Gerrit client application for Android
Stars: ✭ 62 (+58.97%)
Mutual labels:  gerrit
codewing
Next level code navigation for Java and Go on GitHub.
Stars: ✭ 37 (-5.13%)
Mutual labels:  code-review
python-gerrit-api
Python wrapper for the Gerrit REST API.
Stars: ✭ 6 (-84.62%)
Mutual labels:  gerrit

npm license Build Status

gerrit-cli

Gerrit in your command lines.

gerrit-cli provides a command-line interface to the Gerrit code review system. With it you can clone projects, push and checkout patches, assign reviewers, and perform reviews all from the comfort of your shell.

It was born out of the annoyance of having to write out git push origin HEAD:refs/for/branch/topic every time I wanted to push a patch. It's now just gerrit up.

Install

Install using NPM.

$ npm install -g gerrit-cli

Tab completion

Bash tab-completion is also available and can be enabled by adding the following line to your .bashrc file.

source <(gerrit completion)

Zsh completion is not yet available...

Requirements

  • NodeJS >= 0.12
  • Git
  • SSH

Tested with Gerrit 2.12.3, although most likely also works on older versions.

Usage

gerrit-cli is composed of multiple sub-commands, much like git.

Run gerrit help for a list of the commands, and gerrit help <command> for detailed help. Many commands also have shorter aliases listed in the help page.

Commands

help            View help for specified command.
config          Manage server configurations
projects        Display available projects on server.
clone           Clone a project from server.
add-remote      Add project remote for existing repository.
install-hook    Installs the commit message hook.
patches         List details of patches on the server for the current project.
status          Show full details of a specific patch, including comments.
assign          Assign reviewers to the current patch.
up              Push patches of current topic to server for review.
draft           Push patches of current topic to server as drafts.
checkout        Fetch and checkout topic branch from server.
recheckout      Re-checkout current topic.
ssh             Run arbitrary gerrit command on server.
review          Post a review for the current topic.
submit          Submit the current topic for merging.
abandon         Abandon the current topic.
comment         Post a comment on the current topic.
ninja           Push patch to server then immediately submit for merging.
web             Open browser to gerrit web page for current patch.
completion      Enables tab completion for gerrit-cli.
topic           Create new topic branch.
clean           Cleans out merged topic branches.
squad           Manage squads of reviewers.

Feature Walkthrough

First we need to tell gerrit-cli about our server.

$ gerrit config

# Creating new configuration for "default"
# ? Host (ex: example.com) sprockets.com
# ? Port 29418
# ? User george

Now let's clone a project. Note how the commit-msg hook is automatically installed at the end.

$ gerrit clone killer-app

# ? Clone to which folder? killer-app
# Cloning project killer-app from default config into folder killer-app...
# ...
# Installing commit-msg hook...

Now we want to start working on a topic branch.

gerrit-cli has one requirement in order to track your work: your local topic branch needs to track the upstream branch that it is intended to merge into.

We'll use the topic command here, which will simply create a branch that will track the current branch's upstream.

$ gerrit topic lasers

# Branch lasers set up to track remote branch master from origin.

gerrit-cli commands act on the current topic branch, which is now "lasers".

It's time to crank out some code.

$ vim shark.js

# Hack, hack, hack...

$ git commit -m "Added fricken lasers"

Let's create a patch for review on the server for this commit.

$ gerrit up

# Pushing to origin (refs/for/master/lasers)
# remote:
# remote: New Changes:
# remote:   https://sprockets.com/gerrit/57420 Added fricken lasers
# remote:
# To ssh://sprockets.com:29418/killer-app.git
#  * [new branch]      HEAD -> refs/for/master/lasers

Now we'll want to add some reviewers. Let's say that we know we'll often be assigning the same set of reviewers, we can create a squad to group them.

$ gerrit squad set dudes jmartin cbush

# Reviewer(s) "jmartin, cbush" set to squad "dudes".

$ gerrit assign @dudes slevasseur

# Assigned reviewer jmartin
# Assigned reviewer cbush
# Assigned reviewer slevasseur

Let's finish up by reviewing someone else's patch. We can view what patches are on the server with the patches command, we'll add some filter flags for our use right now.

$ gerrit patches --not-reviewed --assigned

# Number  Topic   Branch  Owner    Updated 
# ------  ------  ------  -----    --------
# 123456  fixBug  master  cbush    Mar 14th
# 713705  soleil  master  jmartin  Sep 3rd

We'll check out the first patch.

$ gerrit checkout fixBug

# Getting latest patchset...
# Refspec is refs/changes/56/123456/1

Now that we have the topic branch checked out we can run our tests on it, then leave our review.

$ gerrit review 1 -1 "Bug is fixed, but needs more cow bells."

# Reviews have been posted successfully.

If we want to leave an inline review comment that can't be done through this tool, however you can quickly navigate to the web interface.

$ gerrit web

This concludes the walkthrough! If your legs are tired why don't you sit down and read through gerrit help for more options and advanced use.

License

Copyright (c) Shane Smith. Distributed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].